[ADD] Add no content help menu tip when ungroupped kanban view is empty
authorFabien Meghazi <fme@openerp.com>
Thu, 10 May 2012 09:04:04 +0000 (11:04 +0200)
committerFabien Meghazi <fme@openerp.com>
Thu, 10 May 2012 09:04:04 +0000 (11:04 +0200)
bzr revid: fme@openerp.com-20120510090404-4jix0h2e28satybj

addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/img/list_empty_arrow.png [deleted file]
addons/web/static/src/img/view_empty_arrow.png [new file with mode: 0644]
addons/web/static/src/js/view_list.js
addons/web_kanban/static/src/js/kanban.js
addons/web_kanban/static/src/xml/web_kanban.xml

index 908a913..0c67cec 100644 (file)
@@ -1,4 +1,4 @@
-@charset "UTF-8";
+@charset "utf-8";
 @font-face {
   font-family: "mnmliconsRegular";
   src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot");
 .openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced.oe_opened div {
   display: block;
 }
+.openerp .oe_view_nocontent > img {
+  float: left;
+  margin-right: 1.5em;
+}
+.openerp .oe_view_nocontent > div {
+  overflow: hidden;
+  padding: 6px;
+  font-size: 125%;
+}
 .openerp .oe_view_topbar {
   border-bottom: 1px solid #cacaca;
   background-color: #fcfcfc;
 .openerp .oe_form .oe_form_group_label_border > tbody > tr.oe_form_group_row > td.oe_form_group_cell {
   padding: 2px 2px 2px 8px !important;
 }
-.openerp .oe_listview_nocontent > img {
-  float: left;
-  margin-right: 1.5em;
-}
-.openerp .oe_listview_nocontent > div {
-  overflow: hidden;
-  padding: 6px;
-  font-size: 125%;
-}
 .openerp .oe-listview-content {
   width: 100%;
 }
index d2795b9..1304f9b 100644 (file)
@@ -1068,7 +1068,16 @@ $colour4: #8a89ba
                     div
                         display: block
     // }}}
-    // View.topbar {{{
+    // Views Common {{{
+    .oe_view_nocontent
+        > img
+            float: left
+            margin-right: 1.5em
+        > div
+            // don't encroach on my arrow
+            overflow: hidden
+            padding: 6px
+            font-size: 125%
     .oe_view_topbar
         border-bottom: 1px solid #cacaca
         @include vertical-gradient(#fcfcfc, #dedede)
@@ -1471,15 +1480,6 @@ $colour4: #8a89ba
             padding: 2px 2px 2px 8px !important
     // }}}
     // ListView {{{
-    .oe_listview_nocontent
-        > img
-            float: left
-            margin-right: 1.5em
-        > div
-            // don't encroach on my arrow
-            overflow: hidden
-            padding: 6px
-            font-size: 125%
     .oe-listview-content
         width: 100%
         td, th
diff --git a/addons/web/static/src/img/list_empty_arrow.png b/addons/web/static/src/img/list_empty_arrow.png
deleted file mode 100644 (file)
index b0b1372..0000000
Binary files a/addons/web/static/src/img/list_empty_arrow.png and /dev/null differ
diff --git a/addons/web/static/src/img/view_empty_arrow.png b/addons/web/static/src/img/view_empty_arrow.png
new file mode 100644 (file)
index 0000000..b0b1372
Binary files /dev/null and b/addons/web/static/src/img/view_empty_arrow.png differ
index 9a98764..79e10ea 100644 (file)
@@ -826,8 +826,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
             return;
         }
         this.$element.children('table').replaceWith(
-            $('<div class="oe_listview_nocontent">')
-                .append($('<img>', { src: '/web/static/src/img/list_empty_arrow.png' }))
+            $('<div class="oe_view_nocontent">')
+                .append($('<img>', { src: '/web/static/src/img/view_empty_arrow.png' }))
                 .append($('<div>').html(this.options.action.help)));
     }
 });
index 3040220..08e4eaa 100644 (file)
@@ -136,6 +136,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
     },
     do_search: function(domain, context, group_by) {
         var self = this;
+        this.$element.find('.oe_view_nocontent').remove();
         this.search_domain = domain;
         this.search_context = context;
         this.search_group_by = group_by;
@@ -172,10 +173,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
             var def = $.Deferred();
             self.do_clear_groups();
             self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).then(function(records) {
-                var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset);
-                self.do_add_groups([kgroup]).then(function() {
-                    def.resolve();
-                });
+                if (_.isEmpty(records)) {
+                    self.no_result();
+                    def.reject();
+                } else {
+                    var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset);
+                    self.do_add_groups([kgroup]).then(function() {
+                        def.resolve();
+                    });
+                }
             }).then(null, function() {
                 def.reject();
             });
@@ -288,6 +294,18 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
             this.do_warn("Kanban: could not find id#" + id);
         }
     },
+    no_result: function() {
+        if (this.groups.group_by
+            || !this.options.action
+            || !this.options.action.help) {
+            return;
+        }
+        this.$element.prepend(
+            $('<div class="oe_view_nocontent">')
+                .append($('<img>', { src: '/web/static/src/img/view_empty_arrow.png' }))
+                .append($('<div>').html(this.options.action.help))
+        );
+    }
 });
 
 instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
index 63a404c..979036d 100644 (file)
@@ -1,7 +1,7 @@
 <template>
 <t t-name="KanbanView">
-    <div class="oe_kanban_buttons"/>
     <div class="oe_kanban_view">
+        <div class="oe_kanban_buttons"/>
         <table class="oe_kanban_groups">
         <tr class="oe_kanban_groups_headers">
         </tr>