[FIX] website_forum: restore bind to onclick because CKE Editor uses it, so on('click...
authorJeremy Kersten <jke@odoo.com>
Mon, 1 Dec 2014 14:00:43 +0000 (15:00 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 1 Dec 2014 19:01:00 +0000 (20:01 +0100)
Fixes bugs with z-index error on some popups (image selector for example...)

addons/website_forum/static/src/js/website_forum.js

index 47ff619..1e2e2a4 100644 (file)
             editor.on('instanceReady', CKEDITORLoadComplete);
         }
 
-        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.");
+        }
+    }