Skip to content
Extraits de code Groupes Projets
Valider 12aeff9f rédigé par Matthieu Aubry's avatar Matthieu Aubry
Parcourir les fichiers

Merge pull request #8990 from piwik/8988

Make sure apply button works when no period is changed
parents 46e367d3 ba02b99b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -354,7 +354,24 @@
});
var reloading = false;
var changePeriodOnClick = function (periodInput) {
var changePeriodWithPageReload = function (periodInput) {
var url = periodInput.val(),
period = broadcast.getValueFromUrl('period', url);
// if clicking on the selected period, change the period but not the date
if (period != 'range' && !reloading) {
// only reload if current period is different from selected
reloading = true;
selectedPeriod = period;
updateDate(piwik.currentDateString);
return true;
}
return false;
};
var changePeriodOnClickIfPeriodChanged = function (periodInput) {
if (reloading) // if a click event resulted in reloading, don't reload again
{
return;
......@@ -366,11 +383,10 @@
// if clicking on the selected period, change the period but not the date
if (selectedPeriod == period && selectedPeriod != 'range') {
// only reload if current period is different from selected
if (piwik.period != selectedPeriod && !reloading) {
reloading = true;
selectedPeriod = period;
updateDate(piwik.currentDateString);
if (piwik.period != selectedPeriod) {
return changePeriodWithPageReload(periodInput);
}
return true;
}
......@@ -379,12 +395,12 @@
$("#otherPeriods").find("label,input").on('dblclick', function (e) {
var id = $(e.target).attr('for');
changePeriodOnClick($('#' + id));
changePeriodOnClickIfPeriodChanged($('#' + id));
});
$("#otherPeriods").find("label,input").on('dblclick', function (e) {
var id = $(e.target).attr('for');
changePeriodOnClick($('#' + id));
changePeriodOnClickIfPeriodChanged($('#' + id));
});
// Apply date range button will reload the page with the selected range
......@@ -393,7 +409,7 @@
var $selectedPeriod = $('#periodMore [name=period]:checked');
if (!$selectedPeriod.is('#period_id_range')) {
changePeriodOnClick($selectedPeriod);
changePeriodWithPageReload($selectedPeriod);
return true;
}
......@@ -422,7 +438,7 @@
period = broadcast.getValueFromUrl('period', request_URL),
lastPeriod = selectedPeriod;
if (changePeriodOnClick($(e.target))) {
if (changePeriodOnClickIfPeriodChanged($(e.target))) {
return true;
}
......
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