From ee7c461fea752f363f332ec8cb95f8fdc584fd5e Mon Sep 17 00:00:00 2001 From: x620 Date: Thu, 21 Apr 2016 12:26:35 +0500 Subject: [PATCH 1/3] [FIX] Hiding the left panel if there is no menu --- mail_base/static/src/js/base.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index 68bce6b..948c08d 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -77,8 +77,19 @@ ChatAction.include({ var self = this; return $.when(result).done(function() { + $('.oe_leftbar').toggle(false); self.searchview.do_search(); }); + }, + destroy: function() { + var result = this._super.apply(this, arguments); + $('.oe_leftbar .oe_secondary_menu').each(function(){ + if ($(this).css('display') == 'block' && $(this).children().length > 0){ + $('.oe_leftbar').toggle(true); + return false; + } + }); + return result; } }); From c850e5868e5148fe3fc2b321dc21611e31100b3b Mon Sep 17 00:00:00 2001 From: x620 Date: Thu, 21 Apr 2016 12:32:50 +0500 Subject: [PATCH 2/3] [DOC] add phrase "fixes toggling left bar" to README.rst --- mail_base/README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/mail_base/README.rst b/mail_base/README.rst index 6029868..9e89d30 100644 --- a/mail_base/README.rst +++ b/mail_base/README.rst @@ -3,6 +3,7 @@ Mail Base * makes built-in mail js features extendable. * handle ``search_default_*`` parameters in context. +* fixes toggling left bar Usage ----- From 0e9abc8fc4d305a7b68cde84d423049d2312f5c8 Mon Sep 17 00:00:00 2001 From: x620 Date: Thu, 21 Apr 2016 12:43:47 +0500 Subject: [PATCH 3/3] [FIX] out of the loop when found needed block --- mail_base/static/src/js/base.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index 948c08d..5a43826 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -84,9 +84,11 @@ ChatAction.include({ destroy: function() { var result = this._super.apply(this, arguments); $('.oe_leftbar .oe_secondary_menu').each(function(){ - if ($(this).css('display') == 'block' && $(this).children().length > 0){ - $('.oe_leftbar').toggle(true); - return false; + if ($(this).css('display') == 'block'){ + if ($(this).children().length > 0) { + $('.oe_leftbar').toggle(true); + } + return false; } }); return result;