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:
authordiosmosis <diosmosis@users.noreply.github.com>2019-02-24 05:40:21 +0300
committerGitHub <noreply@github.com>2019-02-24 05:40:21 +0300
commit2b3bb2c5afdea30b9fe160b16d7919c5f10f5ee3 (patch)
tree813b372da8d6d8493f35cb16fa26f39a1a271f5d /plugins/SegmentEditor
parentc02e6cef9e02caa26d4f5c6077263b8b89bfa146 (diff)
In segmented visitor log, allow opening segment editor in new tab w/ segment used. (#14092)
* In segmented visitor log, allow opening segment editor in new tab w/ segment used. * Remove empty title.
Diffstat (limited to 'plugins/SegmentEditor')
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js46
-rw-r--r--plugins/SegmentEditor/lang/en.json3
2 files changed, 31 insertions, 18 deletions
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index bfcdbda067..33606d5d8a 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -123,6 +123,13 @@ Segmentation = (function($) {
}
};
+ function handleAddNewSegment() {
+ var segmentToAdd = broadcast.getValueFromHash('addSegmentAsNew') || broadcast.getValueFromUrl('addSegmentAsNew');
+ if (segmentToAdd) {
+ showAddNewSegmentForm({ definition: decodeURIComponent(segmentToAdd) });
+ }
+ }
+
var getSegmentFromId = function (id) {
if(self.availableSegments.length > 0) {
for(var i = 0; i < self.availableSegments.length; i++)
@@ -298,11 +305,22 @@ Segmentation = (function($) {
});
};
- var displayFormAddNewSegment = function (e) {
+ var displayFormAddNewSegment = function (segment) {
closeAllOpenLists();
- addForm("new");
+ addForm("new", segment);
};
+ function showAddNewSegmentForm(segment) {
+ var parameters = {isAllowed: true};
+ var $rootScope = piwikHelper.getAngularDependency('$rootScope');
+ $rootScope.$emit('Segmentation.initAddSegment', parameters);
+ if (parameters && !parameters.isAllowed) {
+ return;
+ }
+
+ displayFormAddNewSegment(segment);
+ }
+
var filterSegmentList = function (keyword) {
var curTitle;
clearFilterSegmentList();
@@ -327,7 +345,7 @@ Segmentation = (function($) {
if ($(self.target).find(".segmentList .segmentsSharedWithMeBySuperUser li:visible").length == 0) {
$(self.target).find(".segmentList .segmentsSharedWithMeBySuperUser").hide();
}
- }
+ };
var clearFilterSegmentList = function () {
$(self.target).find(" .filterNoResults").remove();
@@ -336,7 +354,7 @@ Segmentation = (function($) {
});
$(self.target).find(".segmentList .segmentsVisibleToSuperUser").show();
$(self.target).find(".segmentList .segmentsSharedWithMeBySuperUser").show();
- }
+ };
var bindEvents = function () {
self.target.on('click', '.segmentationContainer', function (e) {
@@ -391,16 +409,9 @@ Segmentation = (function($) {
});
self.target.on('click', '.add_new_segment', function (e) {
-
- var parameters = {isAllowed: true};
- var $rootScope = piwikHelper.getAngularDependency('$rootScope');
- $rootScope.$emit('Segmentation.initAddSegment', parameters);
- if (parameters && !parameters.isAllowed) {
- return;
- }
-
e.stopPropagation();
- displayFormAddNewSegment(e);
+
+ showAddNewSegmentForm();
});
// attach event that will clear segment list filtering input after clicking x
@@ -574,7 +585,7 @@ Segmentation = (function($) {
}
if(mode == "edit") {
- var userSelector = $(self.form).find('.enable_all_users_select > option[value="' + segment.enable_all_users + '"]').prop("selected",true);
+ $(self.form).find('.enable_all_users_select > option[value="' + segment.enable_all_users + '"]').prop("selected",true);
// Replace "Visible to me" by "Visible to $login" when user is super user
if(hasSuperUserAccessAndSegmentCreatedByAnotherUser(segment)) {
@@ -582,10 +593,10 @@ Segmentation = (function($) {
}
$(self.form).find('.visible_to_website_select > option[value="'+segment.enable_only_idsite+'"]').prop("selected",true);
$(self.form).find('.auto_archive_select > option[value="'+segment.auto_archive+'"]').prop("selected",true);
+ }
- if (segment.definition != ""){
- self.form.find('[piwik-segment-generator]').attr('segment-definition', segment.definition);
- }
+ if (segment.definition != ""){
+ self.form.find('[piwik-segment-generator]').attr('segment-definition', segment.definition);
}
makeDropList(".enable_all_users" , ".enable_all_users_select");
@@ -782,6 +793,7 @@ Segmentation = (function($) {
this.initHtml();
bindEvents();
+ handleAddNewSegment();
};
return segmentation;
diff --git a/plugins/SegmentEditor/lang/en.json b/plugins/SegmentEditor/lang/en.json
index b2ba38c07e..47029183cd 100644
--- a/plugins/SegmentEditor/lang/en.json
+++ b/plugins/SegmentEditor/lang/en.json
@@ -51,6 +51,7 @@
"CustomUnprocessedSegmentApiError4": "Once created the segment in the editor (or via API), this error message will disappear and within a few hours you will see your segmented report data, after the segment data has been pre-processed. (If it does not, there may be a problem.)",
"CustomUnprocessedSegmentApiError5": "Please note that you can test whether your segment will work without having to wait for it to be processed by using the Live.getLastVisitsDetails API.",
"CustomUnprocessedSegmentApiError6": "When using this API method, you will see which users and actions were matched by your &segment= parameter.",
- "CustomUnprocessedSegmentNoData": "To see data for this segment, you must create this segment manually in the Segment Editor, then wait a couple hours for preprocessing to complete."
+ "CustomUnprocessedSegmentNoData": "To see data for this segment, you must create this segment manually in the Segment Editor, then wait a couple hours for preprocessing to complete.",
+ "AddThisToMatomo": "Add this segment to Matomo"
}
} \ No newline at end of file