diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index 12f9bc2e7ae..20baae85d76 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -284,13 +284,12 @@ openerp.base.generate_null_object_class = function(claz, add) { } if (prototype.prototype) copy_proto(prototype.prototype); - } + }; copy_proto(claz.prototype); - var init = openerp.base.BasicController.prototype.init; - newer.init = init; + newer.init = openerp.base.BasicController.prototype.init; var tmpclass = claz.extend(newer); return tmpclass.extend(add || {}); -} +}; openerp.base.Notification = openerp.base.BasicController.extend({ init: function(element_id) { @@ -580,7 +579,7 @@ openerp.base.Controller = openerp.base.BasicController.extend( /** @lends opener */ controller_get: function(key) { return this.controller_registry[key]; - // OR should contrustct it ? setting parent correctly ? + // OR should build it ? setting parent correctly ? // function construct(constructor, args) { // function F() { // return constructor.apply(this, args); @@ -640,7 +639,7 @@ openerp.base.Controller = openerp.base.BasicController.extend( /** @lends opener } // TODO if post prefix //this.element_id = _.uniqueId(_.toArray(arguments).join('_')); - }; + } }, /** * Performs a JSON-RPC call diff --git a/addons/base/static/src/js/views.js b/addons/base/static/src/js/views.js index 6d2c32dfdd9..8d6bdf9b123 100644 --- a/addons/base/static/src/js/views.js +++ b/addons/base/static/src/js/views.js @@ -128,7 +128,7 @@ openerp.base.ViewManager = openerp.base.Controller.extend({ controller.set_embedded_view(view.embedded_view); } if (view_type === 'list' && this.flags.search_view === false && this.action && this.action['auto_search']) { - // In case the search view is not instanciated: manually call ListView#search + // In case the search view is not instantiated: manually call ListView#search var domains = !_(self.action.domain).isEmpty() ? [self.action.domain] : [], contexts = !_(self.action.context).isEmpty() @@ -349,16 +349,12 @@ openerp.base.Sidebar = openerp.base.BaseWidget.extend({ }, do_refresh: function(new_view) { var view = this.view_manager.active_view; - the_condition = this.sections.length > 0 && _.detect(this.sections, + var the_condition = this.sections.length > 0 && _.detect(this.sections, function(x) {return x.elements.length > 0;}) != undefined && (!new_view || view != 'list'); - if (!the_condition) { - this.$element.addClass('closed-sidebar'); - this.$element.removeClass('open-sidebar'); - } else { - this.$element.addClass('open-sidebar'); - this.$element.removeClass('closed-sidebar'); - } + + this.$element.toggleClass('open-sidebar', the_condition) + .toggleClass('closed-sidebar', !the_condition); this.$element.html(QWeb.render("ViewManager.sidebar.internal", { sidebar: this, view: view }));