Skip to content

Commit 19a751d

Browse files
committed
adding listener for segment comparison change so we can mark them properly on UI
1 parent fdcd576 commit 19a751d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/SegmentEditor/javascripts/Segmentation.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ Segmentation = (function($) {
8787
content: title,
8888
});
8989
};
90+
// We will listen to changes in the Segment Comparison Store
91+
// so we can mark compared segments properly. This will now include deletion of compared segments.
92+
piwik.on('piwikComparisonsChanged', function () {
93+
console.log('there was a change in the compared segments');
94+
self.markComparedSegments();
95+
});
9096

9197
segmentation.prototype.markComparedSegments = function() {
9298
var comparisonService = window.CoreHome.ComparisonsStoreInstance;
@@ -114,7 +120,7 @@ Segmentation = (function($) {
114120
if (comparedSegmentsLength >= limit) {
115121
console.log('limit reached');
116122
$(this).addClass('no-click');
117-
$(this).parent().attr('title', _pk_translate('General_MaximumNumberOfSegmentsComparedIs'));
123+
$(this).parent().attr('title', _pk_translate('General_MaximumNumberOfSegmentsComparedIs', [6]));
118124
} else {
119125
console.log('removing class');
120126
$(this).removeClass('no-click');

0 commit comments

Comments
 (0)