[ADD] Add no content help menu tip when ungroupped kanban view is empty

bzr revid: fme@openerp.com-20120510090404-4jix0h2e28satybj
This commit is contained in:
Fabien Meghazi 2012-05-10 11:04:04 +02:00
parent a42cd1e25a
commit 7e39103793
6 changed files with 45 additions and 27 deletions

View 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");
@ -1318,6 +1318,15 @@
.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;
@ -1773,15 +1782,6 @@
.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%;
}

View 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

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View 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)));
}
});

View 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({

View 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>