[FIX] Website - Don't set active on OpenDialog link else the user cannot click on...
authorKersten Jeremy <jke@openerp.com>
Mon, 14 Apr 2014 09:48:03 +0000 (11:48 +0200)
committerKersten Jeremy <jke@openerp.com>
Mon, 14 Apr 2014 09:48:03 +0000 (11:48 +0200)
bzr revid: jke@openerp.com-20140414094803-bfyvu3wizy09n53c

addons/website/static/src/js/website.snippets.editor.js

index ad96b4c..dca134d 100644 (file)
             var self = this;
             var bg = self.$target.css("background-image");
             this.$el.find('li').removeClass("active");
+            this.$el.find('li').removeClass("btn-primary");
             var $active = this.$el.find('li[data-class]')
                 .filter(function () {
                     var $li = $(this);
                     this.$el.find('li[data-class].oe_custom_bg') :
                     this.$el.find('li[data-class=""]');
             }
-            $active.addClass("active");
-            this.$el.find('li:has(li[data-class].active)').addClass("active");
+
+            //don't set active on an OpenDialog link, else it not possible to click on it again after.
+            // TODO in Saas-4 - Once bootstrap is in less
+            //      - add a class active-style to get the same display but without the active behaviour used by bootstrap in JS.
+            var classStr = _.string.contains($active[0].className, "oe_custom_bg") ? "btn-primary" : "active";
+            $active.addClass(classStr);
+            this.$el.find('li:has(li[data-class].active)').addClass(classStr);
         }
     });