From 2b2b1ec41b09e573e1cec5476de32ad81a60309b Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Fri, 8 Jun 2012 14:54:04 +0530 Subject: [PATCH] [IMP] imporved code bzr revid: jam@tinyerp.com-20120608092404-p5832c093dbkwzna --- addons/web_dashboard/static/src/js/dashboard.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js index 8b8d34c6368..42fde360d72 100644 --- a/addons/web_dashboard/static/src/js/dashboard.js +++ b/addons/web_dashboard/static/src/js/dashboard.js @@ -232,14 +232,13 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ }, renderElement: function() { var self = this; - //to Check dash contains any action if not then show the action help - var array= []; - _.each(this.node.children, function(column, column_index) { - array.push(_.include(_.pluck(column.children,"tag"),"action")); + var check = _.detect(this.node.children, function(column, column_index) { + return _.detect(column.children,function(element){ + return element.tag === "action"? element: false; + }); }); - if (! _.include(array,true)){ + if (!check) return self.no_result(); - } // We should start with three columns available for (var i = this.node.children.length; i < 3; i++) { this.node.children.push({ @@ -252,14 +251,10 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ this.$element.html(rendered); }, no_result: function () { - if (!this.view.options.action - || !this.view.options.action.help) { - return; - } this.$element.prepend( $('
') .append($('', { src: '/web_dashboard/static/src/img/view_todo_arrow.png' })) - .append($('
').html(this.view.options.action.help)) + .append($('
').html(this.view.options.action.help || " ")) ); }, do_reload: function() {