From e9732dab8d1bf0aceec6f5e9bb73875c29d23452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 26 May 2014 15:45:28 +0200 Subject: [PATCH] [FIX] fix various issues with the drawer (addon web) * separate the css class oe_searchview_custom into oe_searchview_custom and oe_searchview_savefilter to be able to style them independently * by default, the drawer has display:none * fix a bug occuring when the user removed a custom filter (it hid the remaining filters) --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 4 +++- addons/web/static/src/js/search.js | 14 +++++++------- addons/web/static/src/xml/base.xml | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 53be627f486..7a9250a60fc 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1655,7 +1655,7 @@ .openerp .oe_searchview_drawer form button { margin: 0 0 8px -3px; } -.openerp .oe_searchview_drawer .oe_searchview_custom form { +.openerp .oe_searchview_drawer .oe_searchview_savefilter form { display: none; } .openerp .oe_searchview_drawer .oe_searchview_custom li { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1cea0a006f7..8c78cf6165c 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1292,6 +1292,7 @@ $sheet-padding: 16px .oe_searchview_drawer_container overflow: auto .oe_searchview_drawer + display:none width: 100% cursor: default display: none @@ -1356,9 +1357,10 @@ $sheet-padding: 16px line-height: 18px button margin: 0 0 8px -3px // Managed margin-left according bootstrap3 - .oe_searchview_custom + .oe_searchview_savefilter form display: none + .oe_searchview_custom li cursor: pointer position: relative diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 25c78c36bbf..1e2e91a860d 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -826,10 +826,14 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({ }, start: function() { + var self = this; var filters_ready = this.searchview.fields_view_get .then(this.proxy('prepare_filters')); - return $.when(this._super(), filters_ready) - .then(this.proxy('notify_searchview')); + return $.when(this._super(), filters_ready).then(function () { + self.$el.show(); + var defaults = arguments[1][0]; + self.ready.resolve.apply(null, defaults); + }); }, prepare_filters: function (data) { this.make_widgets( @@ -852,10 +856,6 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({ return $.when(defaults_fetched, add_custom_reports, add_filters, add_rest); }, - notify_searchview: function () { - var defaults = arguments[1][0]; - this.ready.resolve.apply(null, defaults); - }, /** * Sets up thingie where all the mess is put? */ @@ -1807,7 +1807,7 @@ instance.web.search.CustomReports = instance.web.search.Input.extend({ $filter.remove(); delete self.$filters[key]; delete self.filters[key]; - if (!self.filters.length) { + if (!Object.keys(self.filters).length) { self.hide(); } }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 9207ecdbdd2..a8563818b82 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1732,7 +1732,7 @@ -
+

Save current filter