From fe239518110ab6815ab1e7591ab6ad8f5f5750f5 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Fri, 15 Aug 2014 12:25:24 +0200 Subject: refs #5994 add marketplace link to user menu and actually highlight settings in the user menu only if the user is on the user settings for instance to prevent Marketplace and Settings is highlight but also because it does not really make sense otherwise --- .../CoreHome/angularjs/menudropdown/menudropdown.less | 1 - plugins/CoreHome/templates/_topBarTopMenu.twig | 4 ++-- plugins/CorePluginsAdmin/Menu.php | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/CoreHome/angularjs/menudropdown/menudropdown.less b/plugins/CoreHome/angularjs/menudropdown/menudropdown.less index df9b8d3cd3..4128615387 100644 --- a/plugins/CoreHome/angularjs/menudropdown/menudropdown.less +++ b/plugins/CoreHome/angularjs/menudropdown/menudropdown.less @@ -51,7 +51,6 @@ &.active { background-color: @color-silver-l80; - cursor: default; } &.category { diff --git a/plugins/CoreHome/templates/_topBarTopMenu.twig b/plugins/CoreHome/templates/_topBarTopMenu.twig index f839e4223f..5f5831237a 100644 --- a/plugins/CoreHome/templates/_topBarTopMenu.twig +++ b/plugins/CoreHome/templates/_topBarTopMenu.twig @@ -37,8 +37,8 @@ piwik-menudropdown> {% if userLogin != 'anonymous' %} - {% if isAdminLayout is defined %} - {{ 'General_Settings'|translate }} + {% if isAdminLayout is defined and currentModule == 'UsersManager' and currentAction == 'userSettings' %} + {{ 'General_Settings'|translate }} {% else %} {{ 'General_Settings'|translate }} {% endif %} diff --git a/plugins/CorePluginsAdmin/Menu.php b/plugins/CorePluginsAdmin/Menu.php index 3cd9dea086..cd056720d5 100644 --- a/plugins/CorePluginsAdmin/Menu.php +++ b/plugins/CorePluginsAdmin/Menu.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\CorePluginsAdmin; use Piwik\Db; use Piwik\Menu\MenuAdmin; +use Piwik\Menu\MenuUser; use Piwik\Piwik; /** @@ -52,7 +53,7 @@ class Menu extends \Piwik\Plugin\Menu $order = 3); } - if ($isMarketplaceEnabled && !$isAnonymous) { + if ($this->isAllowedToSeeMarketPlace()) { $menu->addPlatformItem('CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), $order = 5); @@ -60,4 +61,20 @@ class Menu extends \Piwik\Plugin\Menu } } + private function isAllowedToSeeMarketPlace() + { + $isAnonymous = Piwik::isUserIsAnonymous(); + $isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled(); + + return $isMarketplaceEnabled && !$isAnonymous; + } + + public function configureUserMenu(MenuUser $menu) + { + if ($this->isAllowedToSeeMarketPlace()) { + $menu->addPlatformItem('CorePluginsAdmin_Marketplace', + array('module' => 'CorePluginsAdmin', 'action' => 'browsePlugins', 'activated' => ''), + $order = 5); + } + } } -- cgit v1.2.3