Skip to content

Commit

Permalink
moved previously hardcoded in template Settings menu element into pro…
Browse files Browse the repository at this point in the history
…per Menu class
  • Loading branch information
Michał Gaździk committed Sep 27, 2014
1 parent 6a959a5 commit d9f1e2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 1 addition & 10 deletions plugins/CoreHome/templates/_topBarTopMenu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,8 @@
menu-title="{{ helloAlias|trim }}"
piwik-menudropdown>

{% if userLogin != 'anonymous' %}
{% if isAdminLayout is defined and currentModule == 'UsersManager' and currentAction == 'userSettings' %}
<a class="item active" href="index.php?module=CoreAdminHome">{{ 'General_Settings'|translate }}</a>
{% else %}
<a class="item" href="index.php?module=CoreAdminHome">{{ 'General_Settings'|translate }}</a>
{% endif %}
{% endif %}

{% for lev1UserLabel,lev1UserMenu in userMenu if lev1UserLabel|slice(0,1) != '_' %}

{% if userLogin != 'anonymous' or not loop.first %}
{% if not loop.first %}
<hr class="item separator"/>
{% endif %}

Expand Down
8 changes: 8 additions & 0 deletions plugins/UsersManager/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Piwik\Plugins\UsersManager;

use Piwik\Menu\MenuAdmin;
use Piwik\Menu\MenuUser;
use Piwik\Piwik;

class Menu extends \Piwik\Plugin\Menu
Expand All @@ -20,4 +21,11 @@ public function configureAdminMenu(MenuAdmin $menu)
$menu->addManageItem('UsersManager_MenuUserSettings', $this->urlForAction('userSettings'), $order = 3);
}
}

public function configureUserMenu(MenuUser $menu)
{
if (!Piwik::isUserIsAnonymous()) {
$menu->addItem('', 'General_Settings', $this->urlForAction('index'), 0);
}
}
}

0 comments on commit d9f1e2f

Please sign in to comment.