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:
authorsgiehl <stefan@piwik.org>2016-07-15 01:31:54 +0300
committersgiehl <stefan@piwik.org>2016-07-15 01:31:54 +0300
commit736d0086d2d041d0a7d234f41732cdb385102549 (patch)
tree06c728da1580f8b1e5fa7356a9bcc35a63bce4ec /plugins/SegmentEditor
parent96f289b0a679b36867e4b5a5b7fed70b8132a2a6 (diff)
add option to hide segment definition change confirm
Diffstat (limited to 'plugins/SegmentEditor')
-rw-r--r--plugins/SegmentEditor/SegmentSelectorControl.php2
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js22
-rw-r--r--plugins/SegmentEditor/lang/en.json1
-rw-r--r--plugins/SegmentEditor/stylesheets/segmentation.less13
-rw-r--r--plugins/SegmentEditor/templates/_segmentSelector.twig8
5 files changed, 42 insertions, 4 deletions
diff --git a/plugins/SegmentEditor/SegmentSelectorControl.php b/plugins/SegmentEditor/SegmentSelectorControl.php
index 866bd2bac5..560af449fa 100644
--- a/plugins/SegmentEditor/SegmentSelectorControl.php
+++ b/plugins/SegmentEditor/SegmentSelectorControl.php
@@ -15,6 +15,7 @@ use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Piwik;
use Piwik\Plugins\API\API as APIMetadata;
+use Piwik\Plugins\UsersManager\API AS UsersManagerAPI;
use Piwik\View\UIControl;
use Piwik\Plugins\SegmentEditor\API as SegmentEditorAPI;
@@ -80,6 +81,7 @@ class SegmentSelectorControl extends UIControl
$this->isUserAnonymous = Piwik::isUserIsAnonymous();
$this->segmentTranslations = $this->getTranslations();
$this->segmentProcessedOnRequest = Rules::isBrowserArchivingAvailableForSegments();
+ $this->hideSegmentDefinitionChangeMessage = UsersManagerAPI::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), 'hideSegmentDefinitionChangeMessage');
}
public function getClientSideProperties()
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index 609368def7..7365a89fd6 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -1076,7 +1076,7 @@ Segmentation = (function($) {
"idSegment": segmentId
});
- if(segmentStr != getSegmentFromId(segmentId).definition) {
+ if(segmentStr != getSegmentFromId(segmentId).definition && $('.segment-definition-change-confirm').data('hideMessage') != 1) {
var segmentProcessedOnRequest = $('.segment-definition-change-confirm').data('segmentProcessedOnRequest');
$('.process-on-request, .no-process-on-request').hide();
@@ -1089,7 +1089,25 @@ Segmentation = (function($) {
piwikHelper.modalConfirm('.segment-definition-change-confirm', {
yes: function () {
- self.updateMethod(params);
+ if ($('#hideSegmentMessage:checked').length) {
+ var ajaxHandler = new ajaxHelper();
+ ajaxHandler.setLoadingElement();
+ ajaxHandler.addParams({
+ "module": 'API',
+ "format": 'json',
+ "method": 'UsersManager.setUserPreference',
+ "userLogin": piwik.userLogin,
+ "preferenceName": "hideSegmentDefinitionChangeMessage",
+ "preferenceValue": "1"
+ }, 'GET');
+ ajaxHandler.useCallbackInCaseOfError();
+ ajaxHandler.setCallback(function (response) {
+ self.updateMethod(params);
+ });
+ ajaxHandler.send(true);
+ } else {
+ self.updateMethod(params);
+ }
}
});
} else {
diff --git a/plugins/SegmentEditor/lang/en.json b/plugins/SegmentEditor/lang/en.json
index 346a573b2d..286682b813 100644
--- a/plugins/SegmentEditor/lang/en.json
+++ b/plugins/SegmentEditor/lang/en.json
@@ -13,6 +13,7 @@
"DataAvailableAtLaterDate": "Your segmented analytics reports will be available later. We apologize for the inconvenience.",
"DefaultAllVisits": "All visits",
"DragDropCondition": "Drag & Drop condition",
+ "HideMessageInFuture": "Hide this message in the future",
"LoadingSegmentedDataMayTakeSomeTime": "Processing segmented visitor data may take a few minutes...",
"OperatorAND": "AND",
"OperatorOR": "OR",
diff --git a/plugins/SegmentEditor/stylesheets/segmentation.less b/plugins/SegmentEditor/stylesheets/segmentation.less
index afc79b3a9b..54367641a6 100644
--- a/plugins/SegmentEditor/stylesheets/segmentation.less
+++ b/plugins/SegmentEditor/stylesheets/segmentation.less
@@ -660,6 +660,17 @@ a.metric_category {
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.2), 0 1px 5px 0 rgba(0,0,0,0.12);
}
+.segment-definition-change-confirm .description {
+ margin-top: 20px;
+ float: left;
+ width: 100%;
+ text-align: center;
+
+ > span {
+ display: inline-block;
+ }
+}
+
@media all and (max-width: 749px) {
span.segmentationTitle,
.segmentEditorPanel.expanded .segmentationContainer {
@@ -669,7 +680,7 @@ a.metric_category {
.dropdown-body {
background-color: #f7f7f7;
- border-top-width: 0px;
+ border-top-width: 0;
display: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
diff --git a/plugins/SegmentEditor/templates/_segmentSelector.twig b/plugins/SegmentEditor/templates/_segmentSelector.twig
index 7a9afb4e02..c4feb158c1 100644
--- a/plugins/SegmentEditor/templates/_segmentSelector.twig
+++ b/plugins/SegmentEditor/templates/_segmentSelector.twig
@@ -167,7 +167,7 @@
<input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/>
<input role="no" type="button" value="{{ 'General_No'|translate }}"/>
</div>
-<div class="ui-confirm segment-definition-change-confirm" data-segment-processed-on-request="{{ segmentProcessedOnRequest|number_format }}">
+<div class="ui-confirm segment-definition-change-confirm" data-segment-processed-on-request="{{ segmentProcessedOnRequest|number_format }}" data-hide-message="{{ hideSegmentDefinitionChangeMessage }}">
<h2>
<span class="process-on-request">
{{ 'SegmentEditor_ChangingSegmentDefinitionConfirmationProcessedOnRequest'|translate }}
@@ -176,6 +176,12 @@
{{ 'SegmentEditor_ChangingSegmentDefinitionConfirmationNotProcessedOnRequest'|translate }}
</span>
</h2>
+ <p class="description">
+ <span>
+ <input type="checkbox" id="hideSegmentMessage" name="hideSegmentMessage" />
+ <label for="hideSegmentMessage">{{ 'SegmentEditor_HideMessageInFuture'|translate }}</label>
+ </span>
+ </p>
<input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/>
<input role="no" type="button" value="{{ 'General_No'|translate }}"/>
</div>