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@piwik.org>2018-05-04 00:14:40 +0300
committerGitHub <noreply@github.com>2018-05-04 00:14:40 +0300
commit83ae9176c7877155b5d793835a7a5ebc0db2127e (patch)
tree4dea6ab6865f81d7c6151caee08442b9227efd10 /plugins/Actions
parent28d5fc9e7ba20d0b4ba7b7fe2fe81940c2243423 (diff)
Removes default action name for flattened action urls (#12669)
* remove default action name for flattened action urls * improve code * update system tests * always prepend action delimiter to flattened action urls * update ui files * update test files * updates CHANGELOG * submodule update
Diffstat (limited to 'plugins/Actions')
-rw-r--r--plugins/Actions/API.php11
-rw-r--r--plugins/Actions/ArchivingHelper.php2
-rw-r--r--plugins/Actions/DataTable/Filter/Actions.php23
-rw-r--r--plugins/Actions/javascripts/actionsDataTable.js2
-rw-r--r--plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_exclude_low_population.png4
-rw-r--r--plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_flattened.png4
6 files changed, 40 insertions, 6 deletions
diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php
index 4a777a0437..2f23b98156 100644
--- a/plugins/Actions/API.php
+++ b/plugins/Actions/API.php
@@ -95,6 +95,17 @@ class API extends \Piwik\Plugin\API
$this->filterActionsDataTable($dataTable);
+ if ($flat) {
+ $dataTable->filter(function(DataTable $dataTable) {
+ foreach ($dataTable->getRows() as $row) {
+ $label = $row->getColumn('label');
+ if (substr($label, 0, 1) !== '/' && $label != Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL'))) {
+ $row->setColumn('label', '/'.$label);
+ }
+ }
+ });
+ }
+
return $dataTable;
}
diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php
index 15834d7295..042815ff0e 100644
--- a/plugins/Actions/ArchivingHelper.php
+++ b/plugins/Actions/ArchivingHelper.php
@@ -306,7 +306,7 @@ class ArchivingHelper
public static function reloadConfig()
{
- // for BC, we read the old style delimiter first (see #1067)Row
+ // for BC, we read the old style delimiter first (see #1067)
$actionDelimiter = @Config::getInstance()->General['action_category_delimiter'];
if (empty($actionDelimiter)) {
self::$actionUrlCategoryDelimiter = Config::getInstance()->General['action_url_category_delimiter'];
diff --git a/plugins/Actions/DataTable/Filter/Actions.php b/plugins/Actions/DataTable/Filter/Actions.php
index 8d13311677..51c24b4097 100644
--- a/plugins/Actions/DataTable/Filter/Actions.php
+++ b/plugins/Actions/DataTable/Filter/Actions.php
@@ -8,6 +8,8 @@
*/
namespace Piwik\Plugins\Actions\DataTable\Filter;
+use Piwik\Common;
+use Piwik\Config;
use Piwik\DataTable\BaseFilter;
use Piwik\DataTable\Row;
use Piwik\DataTable;
@@ -30,11 +32,32 @@ class Actions extends BaseFilter
public function filter($table)
{
$table->filter(function (DataTable $dataTable) {
+
+ $defaultActionName = Config::getInstance()->General['action_default_name'];
+
+ // for BC, we read the old style delimiter first (see #1067)
+ $actionDelimiter = @Config::getInstance()->General['action_category_delimiter'];
+ if (empty($actionDelimiter)) {
+ $actionDelimiter = Config::getInstance()->General['action_url_category_delimiter'];
+ }
+
foreach ($dataTable->getRows() as $row) {
$url = $row->getMetadata('url');
if ($url) {
$row->setMetadata('segmentValue', urldecode($url));
}
+
+ // remove the default action name 'index' in the end of flattened urls and prepend $actionDelimiter
+ if (Common::getRequestVar('flat', 0)) {
+ $label = $row->getColumn('label');
+ $stringToSearch = $actionDelimiter.$defaultActionName;
+ if (substr($label, -strlen($stringToSearch)) == $stringToSearch) {
+ $label = substr($label, 0, -strlen($defaultActionName));
+ $label = rtrim($label, $actionDelimiter) . $actionDelimiter;
+ $row->setColumn('label', $label);
+ }
+ $dataTable->setLabelsHaveChanged();
+ }
}
});
diff --git a/plugins/Actions/javascripts/actionsDataTable.js b/plugins/Actions/javascripts/actionsDataTable.js
index acb3eab702..8a1f6daa18 100644
--- a/plugins/Actions/javascripts/actionsDataTable.js
+++ b/plugins/Actions/javascripts/actionsDataTable.js
@@ -112,7 +112,7 @@
},
openSubtableFromSubtableIfOnlyOneSubtableGiven: function (domElem) {
- var hasOnlyOneRow = domElem.length === 1
+ var hasOnlyOneRow = domElem.length === 1;
var hasOnlyOneSubtable = domElem.hasClass('subDataTable');
if (hasOnlyOneRow && hasOnlyOneSubtable) {
diff --git a/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_exclude_low_population.png b/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_exclude_low_population.png
index 4a3e03d153..a15ba6cdb3 100644
--- a/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_exclude_low_population.png
+++ b/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_exclude_low_population.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:288e98c77eb4f4ff40d175260de216f82afa50032a1d4f4b095f5e238c5559cc
-size 79542
+oid sha256:12cbe63bed57afa70532e0769267a28a288b1c022295bef716b005983fefa5ec
+size 80506
diff --git a/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_flattened.png b/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_flattened.png
index 8fb04a3e91..54abfa97cd 100644
--- a/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_flattened.png
+++ b/plugins/Actions/tests/UI/expected-screenshots/ActionsDataTable_flattened.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:b6b236609a19e3710137cf38fc73c660b730746492001add90cc59d66d7c95b0
-size 478557
+oid sha256:ce68e23d3b29f3e5233141c1df74603a756f0ce1940f7c80c74158e75cb57002
+size 482260