Skip to content
Extraits de code Groupes Projets
Valider 2a0bbe2f rédigé par BeezyT's avatar BeezyT
Parcourir les fichiers

refs #3158: remember selected metric in multi row evolution as part of the url...

refs #3158: remember selected metric in multi row evolution as part of the url - using the back and forward buttons after picking different metrics is possible now

git-svn-id: http://dev.piwik.org/svn/trunk@7182 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 0cd0cf9a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -269,8 +269,7 @@ DataTable_RowActions_RowEvolution.prototype.performAction = function(label, tr, ...@@ -269,8 +269,7 @@ DataTable_RowActions_RowEvolution.prototype.performAction = function(label, tr,
} }
var apiMethod = this.dataTable.param.module + '.' + this.dataTable.param.action; var apiMethod = this.dataTable.param.module + '.' + this.dataTable.param.action;
var urlParam = apiMethod + ':' + isMultiRowEvolution + ':' + label; this.openPopover(apiMethod, isMultiRowEvolution, label);
this.openPopover(urlParam);
}; };
DataTable_RowActions_RowEvolution.prototype.addMultiEvolutionRow = function(label) { DataTable_RowActions_RowEvolution.prototype.addMultiEvolutionRow = function(label) {
...@@ -279,22 +278,27 @@ DataTable_RowActions_RowEvolution.prototype.addMultiEvolutionRow = function(labe ...@@ -279,22 +278,27 @@ DataTable_RowActions_RowEvolution.prototype.addMultiEvolutionRow = function(labe
} }
}; };
DataTable_RowActions_RowEvolution.prototype.openPopover = function(apiMethod, multiRowEvolutionParam, label) {
var urlParam = apiMethod + ':' + multiRowEvolutionParam + ':' + label;
DataTable_RowAction.prototype.openPopover.apply(this, [urlParam]);
};
DataTable_RowActions_RowEvolution.prototype.doOpenPopover = function(urlParam) { DataTable_RowActions_RowEvolution.prototype.doOpenPopover = function(urlParam) {
var urlParamParts = urlParam.split(':'); var urlParamParts = urlParam.split(':');
var apiMethod = urlParamParts[0]; var apiMethod = urlParamParts[0];
urlParamParts.shift(); urlParamParts.shift();
var isMultiRowEvolution = (urlParamParts[0] == '1'); var multiRowEvolutionParam = urlParamParts[0];
urlParamParts.shift(); urlParamParts.shift();
var label = urlParamParts.join(':'); var label = urlParamParts.join(':');
this.showRowEvolution(apiMethod, label, isMultiRowEvolution); this.showRowEvolution(apiMethod, label, multiRowEvolutionParam);
}; };
/** Open the row evolution popover */ /** Open the row evolution popover */
DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMethod, label, isMultiRowEvolution, metric) { DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMethod, label, multiRowEvolutionParam) {
var self = this; var self = this;
...@@ -302,22 +306,28 @@ DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMetho ...@@ -302,22 +306,28 @@ DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMetho
var box = Piwik_Popover.showLoading('Row Evolution'); var box = Piwik_Popover.showLoading('Row Evolution');
box.addClass('rowEvolutionPopover'); box.addClass('rowEvolutionPopover');
// load the popover contents // prepare loading the popover contents
var requestParams = { var requestParams = {
apiMethod: apiMethod, apiMethod: apiMethod,
label: label, label: label,
disableLink: 1 disableLink: 1
}; };
if (metric) { // derive api action and requested column from multiRowEvolutionParam
requestParams.column = metric; var action;
if (multiRowEvolutionParam == '0') {
action = 'getRowEvolutionPopover';
} else if (multiRowEvolutionParam == '1') {
action = 'getMultiRowEvolutionPopover';
} else {
action = 'getMultiRowEvolutionPopover';
requestParams.column = multiRowEvolutionParam;
} }
var action = (isMultiRowEvolution ? 'getMultiRowEvolutionPopover' : 'getRowEvolutionPopover');
piwikHelper.ajaxCall('CoreHome', action, requestParams, function(html) { piwikHelper.ajaxCall('CoreHome', action, requestParams, function(html) {
Piwik_Popover.setContent(html); Piwik_Popover.setContent(html);
// use the popover title returned from the server
var title = box.find('div.popover-title'); var title = box.find('div.popover-title');
if (title.size() > 0) { if (title.size() > 0) {
Piwik_Popover.setTitle(title.html()); Piwik_Popover.setTitle(title.html());
...@@ -346,7 +356,8 @@ DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMetho ...@@ -346,7 +356,8 @@ DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function(apiMetho
// switch metric in multi row evolution // switch metric in multi row evolution
box.find('select.multirowevoltion-metric').change(function() { box.find('select.multirowevoltion-metric').change(function() {
var metric = $(this).val(); var metric = $(this).val();
self.showRowEvolution(apiMethod, label, isMultiRowEvolution, metric); Piwik_Popover.onClose(false); // unbind listener that resets multiEvolutionRows
self.openPopover(apiMethod, metric, label);
return true; return true;
}); });
}, alert, 'html'); }, alert, 'html');
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter