[FIX] fix various issues with the drawer (addon web)
authorGéry Debongnie <ged@odoo.com>
Mon, 26 May 2014 13:45:28 +0000 (15:45 +0200)
committerGéry Debongnie <ged@odoo.com>
Mon, 26 May 2014 13:45:28 +0000 (15:45 +0200)
* 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
addons/web/static/src/css/base.sass
addons/web/static/src/js/search.js
addons/web/static/src/xml/base.xml

index 53be627..7a9250a 100644 (file)
 .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 {
index 1cea0a0..8c78cf6 100644 (file)
@@ -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
index 25c78c3..1e2e91a 100644 (file)
@@ -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();
                         }
                     });
index 9207ecd..a856381 100644 (file)
     </dl>
 </div>
 
- <div t-name="SearchView.SaveFilter" class="oe_searchview_custom">
+ <div t-name="SearchView.SaveFilter" class="oe_searchview_savefilter">
     <h4>Save current filter</h4>
     <form class="oe_form">
         <p class="oe_form_required"><input id="oe_searchview_custom_input" placeholder="Filter name"/></p>