diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-02-24 05:40:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-24 05:40:21 +0300 |
commit | 2b3bb2c5afdea30b9fe160b16d7919c5f10f5ee3 (patch) | |
tree | 813b372da8d6d8493f35cb16fa26f39a1a271f5d /plugins/Live | |
parent | c02e6cef9e02caa26d4f5c6077263b8b89bfa146 (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/Live')
-rw-r--r-- | plugins/Live/Visualizations/VisitorLog.php | 9 | ||||
-rw-r--r-- | plugins/Live/javascripts/SegmentedVisitorLog.js | 3 | ||||
-rw-r--r-- | plugins/Live/javascripts/visitorLog.js | 13 |
3 files changed, 24 insertions, 1 deletions
diff --git a/plugins/Live/Visualizations/VisitorLog.php b/plugins/Live/Visualizations/VisitorLog.php index 575b603d7d..b530045fbe 100644 --- a/plugins/Live/Visualizations/VisitorLog.php +++ b/plugins/Live/Visualizations/VisitorLog.php @@ -113,6 +113,15 @@ class VisitorLog extends Visualization ) ) ); + + $enableAddNewSegment = Common::getRequestVar('enableAddNewSegment', false); + if ($enableAddNewSegment) { + $this->config->datatable_actions[] = [ + 'id' => 'addSegmentToMatomo', + 'title' => Piwik::translate('SegmentEditor_AddThisToMatomo'), + 'icon' => 'icon-segment', + ]; + } } public static function canDisplayViewDataTable(ViewDataTable $view) diff --git a/plugins/Live/javascripts/SegmentedVisitorLog.js b/plugins/Live/javascripts/SegmentedVisitorLog.js index b4d24a8351..b355ce1a75 100644 --- a/plugins/Live/javascripts/SegmentedVisitorLog.js +++ b/plugins/Live/javascripts/SegmentedVisitorLog.js @@ -122,7 +122,8 @@ var SegmentedVisitorLog = function() { action: 'indexVisitorLog', segment: encodeURIComponent(segment), disableLink: 1, - small: 1 + small: 1, + enableAddNewSegment: 1, }; $.extend(requestParams, extraParams); diff --git a/plugins/Live/javascripts/visitorLog.js b/plugins/Live/javascripts/visitorLog.js index 0b9e8ccf78..5784504871 100644 --- a/plugins/Live/javascripts/visitorLog.js +++ b/plugins/Live/javascripts/visitorLog.js @@ -38,6 +38,7 @@ init: function () { dataTablePrototype.init.call(this); + var self = this; initializeVisitorActions(this.$element); // launch visitor profile on visitor profile link click @@ -46,6 +47,18 @@ broadcast.propagateNewPopoverParameter('visitorProfile', $(this).attr('data-visitor-id')); return false; }); + + this.$element.on('click', '.addSegmentToMatomo.dataTableAction', function (e) { + e.preventDefault(); + e.stopPropagation(); + + var url = window.location.href; + url = broadcast.updateParamValue('addSegmentAsNew=' + self.param.segment, url); + url = broadcast.updateParamValue('segment=', url); + url = broadcast.updateParamValue('popover=', url); + + window.open(url, "_blank"); + }); }, _destroy: function () { |