From eb9c5d8fe20aad0093e1abfd6d82efa4f00e03e2 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Tue, 29 May 2012 15:50:25 +0000 Subject: [PATCH] Refresh the whole dashboard when extending the layout SVN:trunk[2053] --- js/dashboard.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/dashboard.js b/js/dashboard.js index 2e0d2b9b3..13785abca 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -132,6 +132,10 @@ $(function() }, cursorAt: { top: 16, left: 16 }, }); + if (options.refresh) + { + me._refresh(); + } }); }, _get_new_id: function() @@ -150,7 +154,7 @@ $(function() }, _make_draggable: function() { - + var me = this; this.element.find('.dashlet').draggable({ revert: 'invalid', appendTo: 'body', zIndex: 9999, helper: function() { @@ -163,6 +167,7 @@ $(function() accept: '.dashlet,.dashlet_icon', drop: function(event, ui) { $( this ).find( ".placeholder" ).remove(); + var bRefresh = $(this).hasClass('layout_extension'); var oDashlet = ui.draggable; if (oDashlet.hasClass('dashlet')) { @@ -170,12 +175,17 @@ $(function() oDashlet.detach(); oDashlet.css({top: 0, left: 0}); oDashlet.appendTo($(this)); + if( bRefresh ) + { + // The layout was extended... refresh the whole dashboard + me._refresh(); + } } else { // inserting a new dashlet var sDashletClass = ui.draggable.attr('dashlet_class'); - $(':itop-dashboard').dashboard('add_dashlet', {dashlet_class: sDashletClass, container: $(this) }) + $(':itop-dashboard').dashboard('add_dashlet', {dashlet_class: sDashletClass, container: $(this), refresh: bRefresh }); } }, });