From e9f4fc98cc98dab4ca1fdab2f6d9697485934beb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 3 Apr 2012 16:15:53 +0200 Subject: [PATCH 1/2] [ADD] display unhelpful message when a list view search yields no result bzr revid: xmo@openerp.com-20120403141553-hrv006vdkv70zyfu --- addons/web/static/src/css/base.css | 9 +++++++++ addons/web/static/src/css/base.sass | 14 ++++++++++++++ addons/web/static/src/img/empty-list-arrow.png | Bin 0 -> 2308 bytes addons/web/static/src/js/view_list.js | 15 +++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 addons/web/static/src/img/empty-list-arrow.png diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b0a2b7945b9..d4a1d743d35 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -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; +} diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index c31f501c499..ecc45f5f538 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -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 {{{ // }}} diff --git a/addons/web/static/src/img/empty-list-arrow.png b/addons/web/static/src/img/empty-list-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..b0b1372adfd3fc393ecc1dac3934c423822970cd GIT binary patch literal 2308 zcmV+f3H$bmP)X)YT08QE{zMm=*yzjy#>qO{b%( zI}c{Mx03c9H98A){3#yqKb--N032OnY{IHxe`j=U0dQ71X*fr_-rMdfhO?Be=W<_8 zj{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pot46o65R>CI%5TPW56 zjRoL3;`2O)>`5R*x_%SNv_FJ-@Pge&g*Sx2U=2c)6y^t@s5?jzQ(Ob(z_q*pU(p$` z$+#1Tp6#RWCcpQB->*ufa&oybk>UURh*Jq_0Ezq1zGqM>Y--%6_DoaeH!B1lHlEIZ zLz`i~@1A1v#RU1xWTntTrZlZBMKamypu9DtiCD#Dj*7%;`zFRa5b;^r_d&oe>c63#sisT!WhY_tYNHW)WAYO5cw(<3g|5%FjIxduIUVGc-3yU9m*M zo;{XZ@Kvj0ZT0#)3Fj^}i~yq}Z9w$?z%jsNVUy$*XY>Nb=mm_CL;ywrMgT?tMiK!S e0T=;z9LPV+S$p2eoZCSF0000') + .append($('', { + src: '/web/static/src/img/empty-list-arrow.png', + alt: _t("This list is empty")})) + .append($('
').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(); }, From da864266c0c374abecad3295f74a57b0d7a394b8 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 3 Apr 2012 16:17:26 +0200 Subject: [PATCH 2/2] [FIX] o2m/m2m lists: only display help when there's help on the action... or an action at all bzr revid: xmo@openerp.com-20120403141726-a6o4sfvifzzjy9r4 --- addons/web/static/src/js/view_list.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index c9a65ac6c4b..85943732c68 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -749,8 +749,9 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# } }, no_result: function () { - var help = this.options.action.help; - if (this.groups.group_by || !help) { + if (this.groups.group_by + || !this.options.action + || !this.options.action.help) { return; } this.$element.children('table').replaceWith( @@ -758,7 +759,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# .append($('', { src: '/web/static/src/img/empty-list-arrow.png', alt: _t("This list is empty")})) - .append($('
').html(help))); + .append($('
').html(this.options.action.help))); } }); openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.ListView.List# */{