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:
authorStefan Giehl <stefan@matomo.org>2019-07-05 16:50:11 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-07-05 16:50:11 +0300
commit1d0cc7295b61f318030caee8e8268253807b3268 (patch)
treed12967c10956f80b5635c8f4c9af2dcf1de1ae70
parentaed8c10c30a7eeafba02477f3877cf0c787b0191 (diff)
Hide date selector when viewing live visits (not as widget) (#14560)
* Hide date selector when viewing live visits (not as widget) * simplify & improve code
-rw-r--r--plugins/CoreHome/angularjs/period-selector/period-selector.directive.js13
-rw-r--r--plugins/Live/javascripts/live.js6
-rw-r--r--plugins/UserCountryMap/javascripts/realtime-map.js13
3 files changed, 18 insertions, 14 deletions
diff --git a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js b/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js
index e7328b0045..aace894274 100644
--- a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js
+++ b/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js
@@ -12,9 +12,9 @@
(function () {
angular.module('piwikApp').directive('piwikPeriodSelector', piwikPeriodSelector);
- piwikPeriodSelector.$inject = ['piwik'];
+ piwikPeriodSelector.$inject = ['piwik', '$rootScope'];
- function piwikPeriodSelector(piwik) {
+ function piwikPeriodSelector(piwik, $rootScope) {
return {
restrict: 'A',
scope: {
@@ -29,6 +29,15 @@
scope.$on('$locationChangeSuccess', scope.periodSelector.updateSelectedValuesFromHash);
+ $rootScope.$on('hidePeriodSelector', function () {
+ element.hide();
+ });
+
+ // some widgets might hide the period selector using the event above, so ensure it's shown again when switching the page
+ $rootScope.$on('piwikPageChange', function () {
+ element.show();
+ });
+
function closePeriodSelector() {
element.find('.periodSelector').removeClass('expanded');
}
diff --git a/plugins/Live/javascripts/live.js b/plugins/Live/javascripts/live.js
index 32cb9e09c2..839c902f1d 100644
--- a/plugins/Live/javascripts/live.js
+++ b/plugins/Live/javascripts/live.js
@@ -170,6 +170,11 @@
this.currentInterval = this.options.interval;
+ if (0 === $(this.element).parents('.widget').length) {
+ var $rootScope = piwikHelper.getAngularDependency('$rootScope');
+ $rootScope.$emit('hidePeriodSelector');
+ }
+
var self = this;
window.setTimeout(function() { self._initTooltips(); }, 250);
@@ -181,7 +186,6 @@
* Stops requests if widget is destroyed
*/
_destroy: function () {
-
this.stop();
},
diff --git a/plugins/UserCountryMap/javascripts/realtime-map.js b/plugins/UserCountryMap/javascripts/realtime-map.js
index 6bd2dfe0f6..39d97a7497 100644
--- a/plugins/UserCountryMap/javascripts/realtime-map.js
+++ b/plugins/UserCountryMap/javascripts/realtime-map.js
@@ -57,18 +57,9 @@
},
_initStandaloneMap: function () {
- $('#periodString').hide();
- initTopControls();
-
var $rootScope = piwikHelper.getAngularDependency('$rootScope');
- $rootScope.$on('piwikPageChange', function () {
- var href = location.href;
- var clickedMenuIsNotMap = !href || (href.indexOf('module=UserCountryMap&action=realtimeWorldMap') == -1);
- if (clickedMenuIsNotMap) {
- $('#periodString').show();
- initTopControls();
- }
- });
+ $rootScope.$emit('hidePeriodSelector');
+
$('.realTimeMap_overlay').css('top', '0px');
$('.realTimeMap_datetime').css('top', '20px');
},