From 646de9e5afbd448f19e683e5811e8169fb6b023c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 19 May 2014 15:40:45 +0200 Subject: [PATCH] [FIX] add support for default filters in search view support for default filters was broken in the previous commit, now it works again. --- addons/web/static/src/css/base.css | 1 + addons/web/static/src/css/base.sass | 3 ++- addons/web/static/src/js/search.js | 28 ++++++++++++++-------------- addons/web/static/src/xml/base.xml | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 03066c171b4..ade49c3b1fe 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1778,6 +1778,7 @@ } .openerp .oe_searchview_drawer_container { border-bottom: 1px solid #afafb6; + overflow: auto; } .openerp .oe_view_nocontent { padding: 15px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e1296924629..d85b55d854c 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1280,7 +1280,7 @@ $sheet-padding: 16px &.oe_searchview_open_drawer .oe_searchview_drawer display: block - + .oe_searchview_drawer cursor: default position: absolute @@ -1460,6 +1460,7 @@ $sheet-padding: 16px .oe_searchview_drawer_container border-bottom: 1px solid $tag-border + overflow: auto // }}} // Views Common {{{ diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 88cf7531fec..0bd4c89f002 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -640,8 +640,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea }); }, setup_default_query: function () { - this.ready.resolve(); - return; // Hacky implementation of CustomFilters#facet_for_defaults ensure // CustomFilters will be ready (and CustomFilters#filters will be // correctly filled) by the time this method executes. @@ -803,23 +801,25 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({ this.add_common_inputs(); // build drawer - var drawer_started = $.when.apply( - null, _(this.select_for_drawer()).invoke( - 'appendTo', this.$el)); + var in_drawer = this.select_for_drawer(); - - // load defaults - // var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( - // 'facet_for_defaults', this.defaults)) - // .then(this.proxy('setup_default_query')); + var self = this; + var second_col = $('
'); + var insert_first_col = in_drawer[0].appendTo(this.$el).then(function () { + second_col.appendTo(self.$el); + }).then(function () { + return $.when.apply(null, + _(_.rest(in_drawer)).invoke('appendTo', second_col)); + }); + + return $.when.apply(null, _(this.inputs).invoke( + 'facet_for_defaults', this.searchview.defaults)); }, notify_searchview: function () { - this.searchview.drawer_ready.resolve(); - - // with args... - // this.searchview.drawer_ready.resolve(); + var defaults = arguments[1]; + this.searchview.drawer_ready.resolve.apply(null, defaults); }, /** * Sets up thingie where all the mess is put? diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 22e344f2b3d..542a7408f54 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1717,7 +1717,7 @@
-
+