From d145c7a8c4bd828d741fdd6fd9f3d8d0fee0fa84 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 24 Dec 2013 16:37:35 +0100 Subject: [PATCH] [IMP] displays a nice message when the graph view has no data to display (addon web_graph) bzr revid: ged@openerp.com-20131224153735-on6cx12v7x2r1ln0 --- addons/web_graph/static/src/css/graph.css | 4 ++++ addons/web_graph/static/src/js/graph.js | 6 ++++-- addons/web_graph/static/src/xml/web_graph.xml | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/addons/web_graph/static/src/css/graph.css b/addons/web_graph/static/src/css/graph.css index 764fcdca209..7b3e289e548 100644 --- a/addons/web_graph/static/src/css/graph.css +++ b/addons/web_graph/static/src/css/graph.css @@ -4,6 +4,10 @@ text-align: right; } +.graph_main_content .oe_view_nocontent_create:before { + background-image: none !important; +} + td.graph_border { background-color: rgb(227, 227, 227); text-align: left; diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index c155337d90e..17a0721fd82 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -272,6 +272,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({ display_data: function () { this.$('.graph_main_content svg').remove(); + this.$('.graph_main_content div').remove(); this.table.empty(); if (this.visible_ui) { @@ -280,8 +281,9 @@ instance.web_graph.Graph = instance.web.Widget.extend({ this.$('.graph_header').css('display', 'none'); } if (this.pivot.no_data) { - var msg = 'No data available. Try to remove any filter or add some data.'; - this.table.append($('' + msg + '')); + this.$('.graph_main_content').append($(QWeb.render('graph_no_data'))); + // var msg = 'No data available. Try to remove any filter or add some data.'; + // this.table.append($('' + msg + '')); } else { var table_modes = ['pivot', 'heatmap', 'row_heatmap', 'col_heatmap']; if (_.contains(table_modes, this.mode)) { diff --git a/addons/web_graph/static/src/xml/web_graph.xml b/addons/web_graph/static/src/xml/web_graph.xml index c96ce941767..8c1791d80d5 100644 --- a/addons/web_graph/static/src/xml/web_graph.xml +++ b/addons/web_graph/static/src/xml/web_graph.xml @@ -52,4 +52,13 @@ +
+

+ No data to display. +

+

+ No data are available. Try to add some records, or make sure + that there is no active filter in the search bar. +

+