[ADD] display unhelpful message when a list view search yields no result

bzr revid: xmo@openerp.com-20120403141553-hrv006vdkv70zyfu
This commit is contained in:
Xavier Morel 2012-04-03 16:15:53 +02:00
parent 7270d04618
commit e9f4fc98cc
4 changed files with 38 additions and 0 deletions

View File

@ -344,3 +344,12 @@
-webkit-box-shadow: none;
-box-shadow: none;
}
.openerp2 .oe-listview .oe_listview_nocontent > img {
float: left;
margin-right: 1.5em;
}
.openerp2 .oe-listview .oe_listview_nocontent > div {
overflow: hidden;
font-size: 150%;
width: 60ex;
}

View File

@ -337,6 +337,20 @@ $colour4: #8a89ba
@include box-shadow(none)
// }}}
// ListView {{{
.oe-listview
.oe_listview_nocontent
> img
float: left
margin-right: 1.5em
> div
// don't encroach on my arrow
overflow: hidden
font-size: 150%
width: 60ex
// }}}
.openerp
// Transitional overrides for old styles {{{
// }}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -747,6 +747,18 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
.attr('colspan', this.previous_colspan);
this.previous_colspan = null;
}
},
no_result: function () {
var help = this.options.action.help;
if (this.groups.group_by || !help) {
return;
}
this.$element.children('table').replaceWith(
$('<div class="oe_listview_nocontent">')
.append($('<img>', {
src: '/web/static/src/img/empty-list-arrow.png',
alt: _t("This list is empty")}))
.append($('<div>').html(help)));
}
});
openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.ListView.List# */{
@ -1344,6 +1356,9 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L
self.records.add(records, {silent: true});
list.render();
d.resolve(list);
if (_.isEmpty(records)) {
view.no_result();
}
});});
return d.promise();
},