Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dashboard/templates/Dashboard.js')
-rw-r--r--plugins/Dashboard/templates/Dashboard.js42
1 files changed, 31 insertions, 11 deletions
diff --git a/plugins/Dashboard/templates/Dashboard.js b/plugins/Dashboard/templates/Dashboard.js
index 73f15ecb04..74d81ec3b7 100644
--- a/plugins/Dashboard/templates/Dashboard.js
+++ b/plugins/Dashboard/templates/Dashboard.js
@@ -79,15 +79,30 @@ 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);
+ if(widget == false)
+ {
+ return;
+ }
+ widgetParameters = widget["parameters"];
+ $.ajax(widgetsHelper.getLoadWidgetAjaxRequest(uniqueId, widgetParameters, onWidgetLoadedReplaceElementWithContent));
+ },
addDummyWidgetAtBottomOfColumn: function(columnNumber)
{
@@ -109,13 +124,14 @@ dashboard.prototype =
}
columnElement = $(self.dashboardColumnsElement[columnNumber]);
emptyWidgetContent = '<div class="sortable">'+
- widgetsHelper.getEmptyWidgetHtml(uniqueId, widgetName, _pk_translate('Dashboard_LoadingWidget_js'))+
+ widgetsHelper.getEmptyWidgetHtml(uniqueId, widgetName)+
'</div>';
if(addWidgetOnTop) {
columnElement.prepend(emptyWidgetContent);
} else {
columnElement.append(emptyWidgetContent);
}
+
widgetElement = $('#'+ uniqueId);
widgetElement
.hover( function() {
@@ -141,10 +157,14 @@ dashboard.prototype =
{
var self = this;
- function onStart() {
+ function onStart(event, ui) {
+ if(!jQuery.support.noCloneEvent) {
+ $('object', this).hide();
+ }
}
function onStop(event, ui) {
+ $('object', this).show();
$('.widgetHover', this).removeClass('widgetHover');
$('.widgetTopHover', this).removeClass('widgetTopHover');
$('.button#close', this).hide();
@@ -161,7 +181,7 @@ dashboard.prototype =
forcePlaceholderSize: true,
placeholder: 'hover',
handle: '.widgetTop',
- helper: 'original',
+ helper: 'clone',
start: onStart,
stop: onStop
});
@@ -221,7 +241,7 @@ dashboard.prototype =
var ajaxRequest =
{
type: 'POST',
- url: 'index.php?module=Dashboard&action=saveLayout',
+ url: 'index.php?module=Dashboard&action=saveLayout&token_auth='+piwik.token_auth,
dataType: 'html',
async: true,
error: piwikHelper.ajaxHandleError,