diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-03-12 17:20:26 +0300 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-03-12 17:20:26 +0300 |
commit | ee0f100d1ad1e6e0fef49ebba6d5e86d2d916236 (patch) | |
tree | bb1514bd6b10acdc1173be153d5983502eb6c946 /plugins/Dashboard | |
parent | 5df6376a97555e3bc515fe7ee430f3d8b4073ed8 (diff) |
Fixes #59
Thanks Eddie for the patch!
I also made a few changes:
- using common Piwik function Piwik::sendHttpRequest to fecth remote data
- added error use cases (empty data back, feed is not authorized)
- cleaned up CSS
- when the feed name is updated, the widget will automatically reload (added helper functions in dashboard JS object to reload a widget)
Diffstat (limited to 'plugins/Dashboard')
-rw-r--r-- | plugins/Dashboard/templates/Dashboard.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/plugins/Dashboard/templates/Dashboard.js b/plugins/Dashboard/templates/Dashboard.js index 73f15ecb04..80600d36ad 100644 --- a/plugins/Dashboard/templates/Dashboard.js +++ b/plugins/Dashboard/templates/Dashboard.js @@ -79,15 +79,26 @@ dashboard.prototype = // load all widgets $('.widget', self.dashboardElement).each( function() { var uniqueId = $(this).attr('id'); - function onWidgetLoadedReplaceElementWithContent(loadedContent) - { - $('#'+uniqueId+'>.widgetContent', self.dashboardElement).html(loadedContent); - } - widget = widgetsHelper.getWidgetObjectFromUniqueId(uniqueId); - widgetParameters = widget["parameters"]; - $.ajax(widgetsHelper.getLoadWidgetAjaxRequest(uniqueId, widgetParameters, onWidgetLoadedReplaceElementWithContent)); + self.reloadWidget(uniqueId); }); }, + + reloadEnclosingWidget: function(domNodeInsideWidget) + { + var uniqueId = $(domNodeInsideWidget).parents('.widget').attr('id'); + this.reloadWidget(uniqueId); + }, + + reloadWidget: function(uniqueId) + { + function onWidgetLoadedReplaceElementWithContent(loadedContent) + { + $('#'+uniqueId+'>.widgetContent', self.dashboardElement).html(loadedContent); + } + widget = widgetsHelper.getWidgetObjectFromUniqueId(uniqueId); + widgetParameters = widget["parameters"]; + $.ajax(widgetsHelper.getLoadWidgetAjaxRequest(uniqueId, widgetParameters, onWidgetLoadedReplaceElementWithContent)); + }, addDummyWidgetAtBottomOfColumn: function(columnNumber) { |