X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fwebsite_forum%2Fstatic%2Fsrc%2Fjs%2Fwebsite_forum.js;fp=addons%2Fwebsite_forum%2Fstatic%2Fsrc%2Fjs%2Fwebsite_forum.js;h=2e16ebb239bad21a7a83b78c27b43d825ab3ece8;hb=c15f748be05b3709f5e16680569abdc2949468e2;hp=fd13a6e5814b927308a740f37e62312e354be617;hpb=1dbf153eb51303c4186ca5e2dacd729aadd95f28;p=odoo%2Fodoo.git
diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js
index fd13a6e..2e16ebb 100644
--- a/addons/website_forum/static/src/js/website_forum.js
+++ b/addons/website_forum/static/src/js/website_forum.js
@@ -133,16 +133,14 @@
if ($link.attr("value").search("^http(s?)://.*")) {
var $warning = $('
'+
''+
- 'Please enter valid URl.'+
+ 'Please enter valid URL. Example: http://www.odoo.com'+
'
');
$link.parent().append($warning);
- $link.parent().find("button#btn_post_your_article")[0].disabled = true;
- $link.parent().find("input[name='content']")[0].value = '';
+ $("button#btn_post_your_article")[0].disabled = true;
} else {
openerp.jsonRpc("/forum/get_url_title", 'call', {'url': $link.attr("value")}).then(function (data) {
- $link.parent().find("input[name='content']")[0].value = data;
- $('button').prop('disabled', false);
- $('input').prop('readonly', false);
+ $("input[name='post_name']")[0].value = data;
+ $('button#btn_post_your_article').prop('disabled', false);
});
}
});
@@ -164,7 +162,6 @@
isNew: true,
};
}
-
}
},
formatResult: function(term) {
@@ -197,7 +194,7 @@
// Take default tags from the input value
initSelection: function (element, callback) {
var data = [];
- _.each(JSON.parse(element.val()), function(x) {
+ _.each(element.data('init-value'), function(x) {
data.push({ id: x.id, text: x.name, isNew: false });
});
element.val('');
@@ -212,22 +209,21 @@
}
});
}
-
- function IsKarmaValid(eventNumber,minKarma){
- "use strict";
- if(parseInt($("#karma").val()) >= minKarma){
- CKEDITOR.tools.callFunction(eventNumber,this);
- return false;
- } else {
- alert("Sorry you need more than " + minKarma + " Karma.");
- }
- }
-
+
function CKEDITORLoadComplete(){
"use strict";
- $('.cke_button__link').on('click', function() { IsKarmaValid(33,30); });
- $('.cke_button__unlink').on('click', function() { IsKarmaValid(37,30); });
- $('.cke_button__image').on('click', function() { IsKarmaValid(41,30); });
+ $('.cke_button__link').attr('onclick','website_forum_IsKarmaValid(33,30)');
+ $('.cke_button__unlink').attr('onclick','website_forum_IsKarmaValid(37,30)');
+ $('.cke_button__image').attr('onclick','website_forum_IsKarmaValid(41,30)');
}
});
+ function website_forum_IsKarmaValid(eventNumber, minKarma){
+ "use strict";
+ if(parseInt($("#karma").val()) >= minKarma){
+ CKEDITOR.tools.callFunction(eventNumber, this);
+ return false;
+ } else {
+ alert("Sorry you need more than " + minKarma + " Karma.");
+ }
+ }