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:
authorKate Butler <kate@innocraft.com>2019-08-05 06:20:40 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-08-05 06:20:40 +0300
commit1aefe69b03edc69efc3d27e77b4cafaf0e9e7ca1 (patch)
tree3dcf5726f53ccb2b5105a65c499b736a88357f51
parent2aa7c822b17e62dfde9fd2cd4c608e5a6e71d439 (diff)
Quick links widget (#14689)
* Quick links widget * Add new widget to widget metadata test reference file * Update test * Move quicklinks widget and add icons for each item * Update reference screenshots
-rw-r--r--plugins/CoreAdminHome/templates/home.twig7
-rw-r--r--plugins/CoreHome/Widgets/QuickLinks.php26
-rw-r--r--plugins/CoreHome/lang/en.json3
-rw-r--r--plugins/CoreHome/templates/quickLinks.twig15
-rw-r--r--plugins/UsersManager/angularjs/users-manager/users-manager.component.js5
-rw-r--r--tests/PHPUnit/Fixtures/UITestFixture.php1
-rw-r--r--tests/PHPUnit/Integration/WidgetsListTest.php2
-rw-r--r--tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getWidgetMetadata.xml19
-rw-r--r--tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png4
-rw-r--r--tests/UI/expected-screenshots/UIIntegrationTest_api_error.png4
10 files changed, 76 insertions, 10 deletions
diff --git a/plugins/CoreAdminHome/templates/home.twig b/plugins/CoreAdminHome/templates/home.twig
index 0c52fdf9c1..a54c0b17aa 100644
--- a/plugins/CoreAdminHome/templates/home.twig
+++ b/plugins/CoreAdminHome/templates/home.twig
@@ -19,6 +19,7 @@
{% if isSuperUser %}
<div class="row">
<div class="col s12 {% if isFeedbackEnabled %}m4{% else %}m6{% endif %}">
+ <div piwik-widget-loader='{"module":"CoreHome","action":"quickLinks"}'></div>
<div piwik-widget-loader='{"module":"CoreHome","action":"getSystemSummary"}'></div>
</div>
{% if hasDiagnostics or hasTrackingFailures %}
@@ -31,11 +32,11 @@
{% endif %}
</div>
{% endif %}
+ <div class="col s12 m4">
{% if isFeedbackEnabled %}
- <div class="col s12 m4">
- {{ feedbackHelp|raw }}
- </div>
+ {{ feedbackHelp|raw }}
{% endif %}
+ </div>
</div>
{% elseif isFeedbackEnabled %}
{{ feedbackHelp|raw }}
diff --git a/plugins/CoreHome/Widgets/QuickLinks.php b/plugins/CoreHome/Widgets/QuickLinks.php
new file mode 100644
index 0000000000..9f543ff51b
--- /dev/null
+++ b/plugins/CoreHome/Widgets/QuickLinks.php
@@ -0,0 +1,26 @@
+<?php
+
+
+namespace Piwik\Plugins\CoreHome\Widgets;
+
+
+use Piwik\Piwik;
+use Piwik\Widget\Widget;
+use Piwik\Widget\WidgetConfig;
+
+class QuickLinks extends Widget
+{
+ public static function configure(WidgetConfig $config)
+ {
+ $config->setCategoryId('About Matomo');
+ $config->setName('CoreHome_QuickLinks');
+ $config->setOrder(16);
+ $config->setIsEnabled(Piwik::hasUserSuperUserAccess());
+ }
+
+ public function render()
+ {
+ return $this->renderTemplate('quickLinks');
+ }
+
+} \ No newline at end of file
diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json
index 1c6970ce51..00ce74d0b4 100644
--- a/plugins/CoreHome/lang/en.json
+++ b/plugins/CoreHome/lang/en.json
@@ -106,6 +106,7 @@
"StandardReport": "Standard report",
"FlattenReport": "Flatten report",
"ReportWithMetadata": "Report with metadata",
- "SeeAvailableVersions": "See Available Versions"
+ "SeeAvailableVersions": "See Available Versions",
+ "QuickLinks": "Quick Links"
}
}
diff --git a/plugins/CoreHome/templates/quickLinks.twig b/plugins/CoreHome/templates/quickLinks.twig
new file mode 100644
index 0000000000..4924351660
--- /dev/null
+++ b/plugins/CoreHome/templates/quickLinks.twig
@@ -0,0 +1,15 @@
+<div class="widgetBody quickLinks">
+ <div class="quickLink">
+ <span class="icon icon-open-source">&nbsp;</span>
+ <a href="{{ linkTo({'module': 'SitesManager', 'action': 'index', 'showaddsite': '1'}) }}" class="itemLabel">
+ {{ 'SitesManager_AddSite'|translate|e }}
+ </a>
+ </div>
+ <div class="quickLink">
+ <span class="icon icon-user-add">&nbsp;</span>
+ <a href="{{ linkTo({'module': 'UsersManager', 'action': 'index', 'showadduser': '1'}) }}" class="itemLabel">
+ {{ 'UsersManager_AddUser'|translate|e }}
+ </a>
+ </div>
+ <br />
+</div> \ No newline at end of file
diff --git a/plugins/UsersManager/angularjs/users-manager/users-manager.component.js b/plugins/UsersManager/angularjs/users-manager/users-manager.component.js
index ffe85ffc36..1e86b9f11f 100644
--- a/plugins/UsersManager/angularjs/users-manager/users-manager.component.js
+++ b/plugins/UsersManager/angularjs/users-manager/users-manager.component.js
@@ -26,7 +26,10 @@
function UsersManagerController($element, piwik, piwikApi, $q, $timeout) {
var vm = this;
- vm.isEditing = false;
+
+ var search = String(window.location.search);
+ vm.isEditing = !!piwik.helper.getArrayFromQueryString(search).showadduser;
+
vm.isCurrentUserSuperUser = true;
// search state
diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php
index 5d13e025da..06b4a5650b 100644
--- a/tests/PHPUnit/Fixtures/UITestFixture.php
+++ b/tests/PHPUnit/Fixtures/UITestFixture.php
@@ -317,6 +317,7 @@ class UITestFixture extends SqlDump
if ($widget['uniqueId'] == 'widgetSEOgetRank'
|| $widget['uniqueId'] == 'widgetLivegetVisitorProfilePopup'
|| $widget['uniqueId'] == 'widgetActionsgetPageTitles'
+ || $widget['uniqueId'] == 'widgetCoreHomequickLinks'
|| strpos($widget['uniqueId'], 'widgetExample') === 0
) {
continue;
diff --git a/tests/PHPUnit/Integration/WidgetsListTest.php b/tests/PHPUnit/Integration/WidgetsListTest.php
index 21e43d06ba..5e86d1c12e 100644
--- a/tests/PHPUnit/Integration/WidgetsListTest.php
+++ b/tests/PHPUnit/Integration/WidgetsListTest.php
@@ -49,7 +49,7 @@ class WidgetsListTest extends IntegrationTestCase
'Insights_WidgetCategory' => 2,
'ExampleUI_UiFramework' => 8,
'Referrers_Referrers' => 10,
- 'About Matomo' => 12,
+ 'About Matomo' => 13,
);
// number of main categories
$this->assertEquals(count($numberOfWidgets), count($widgetsPerCategory));
diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getWidgetMetadata.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getWidgetMetadata.xml
index 7b0a41ce18..9e007550dd 100644
--- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getWidgetMetadata.xml
+++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getWidgetMetadata.xml
@@ -3374,6 +3374,25 @@
<isWide>0</isWide>
</row>
<row>
+ <name>Quick Links</name>
+ <category>
+ <id>About Matomo</id>
+ <name>About Matomo</name>
+ <order>99</order>
+ <icon />
+ </category>
+ <subcategory />
+ <module>CoreHome</module>
+ <action>quickLinks</action>
+ <order>16</order>
+ <parameters>
+ <module>CoreHome</module>
+ <action>quickLinks</action>
+ </parameters>
+ <uniqueId>widgetCoreHomequickLinks</uniqueId>
+ <isWide>0</isWide>
+ </row>
+ <row>
<name>Example Widget Name</name>
<category>
<id>About Matomo</id>
diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png
index e0f7b68ea0..c42fddec26 100644
--- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png
+++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:28b69f19ad8d27b0c6dfbfac21a4d4b3bcc4e8bc2e7662fc690e132ba0847a7d
-size 140940
+oid sha256:e8f8ad570e5617fbab6e2d1056109782a9e31a13b585c4542b92d415f1209129
+size 150860
diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_api_error.png b/tests/UI/expected-screenshots/UIIntegrationTest_api_error.png
index e0f7b68ea0..c42fddec26 100644
--- a/tests/UI/expected-screenshots/UIIntegrationTest_api_error.png
+++ b/tests/UI/expected-screenshots/UIIntegrationTest_api_error.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:28b69f19ad8d27b0c6dfbfac21a4d4b3bcc4e8bc2e7662fc690e132ba0847a7d
-size 140940
+oid sha256:e8f8ad570e5617fbab6e2d1056109782a9e31a13b585c4542b92d415f1209129
+size 150860