Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 48eabd0

Browse files
committed
fix(core menu): Menuize the account routes so they can be added to by submodules
Newlines fix Removed Comment
1 parent 3ab760a commit 48eabd0

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
(function () {
2+
'use strict';
3+
4+
angular
5+
.module('core')
6+
.run(MenuConfig);
7+
8+
MenuConfig.$inject = ['Menus'];
9+
10+
function MenuConfig(Menus) {
11+
12+
Menus.addMenu('account', {
13+
roles: ['user']
14+
});
15+
16+
Menus.addMenuItem('account', {
17+
title: '',
18+
state: 'settings',
19+
type: 'dropdown',
20+
roles: ['user']
21+
});
22+
23+
Menus.addSubMenuItem('account', 'settings', {
24+
title: 'Edit Profile',
25+
state: 'settings.profile'
26+
});
27+
28+
Menus.addSubMenuItem('account', 'settings', {
29+
title: 'Edit Profile Picture',
30+
state: 'settings.picture'
31+
});
32+
33+
Menus.addSubMenuItem('account', 'settings', {
34+
title: 'Change Password',
35+
state: 'settings.password'
36+
});
37+
38+
Menus.addSubMenuItem('account', 'settings', {
39+
title: 'Manage Social Accounts',
40+
state: 'settings.accounts'
41+
});
42+
43+
}
44+
45+
})();

modules/core/client/controllers/header.client.controller.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ angular.module('core').controller('HeaderController', ['$scope', '$state', 'Auth
99
// Get the topbar menu
1010
$scope.menu = Menus.getMenu('topbar');
1111

12+
// Get the account menu
13+
$scope.accountMenu = Menus.getMenu('account').items[0];
14+
1215
// Toggle the menu items
1316
$scope.isCollapsed = false;
1417
$scope.toggleCollapsibleMenu = function () {

modules/core/client/views/header.client.view.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,8 @@
3636
<span ng-bind="authentication.user.displayName"></span> <b class="caret"></b>
3737
</a>
3838
<ul class="dropdown-menu" role="menu">
39-
<li ui-sref-active="active">
40-
<a ui-sref="settings.profile">Edit Profile</a>
41-
</li>
42-
<li ui-sref-active="active">
43-
<a ui-sref="settings.picture">Change Profile Picture</a>
44-
</li>
45-
<li ui-sref-active="active" ng-show="authentication.user.provider === 'local'">
46-
<a ui-sref="settings.password">Change Password</a>
47-
</li>
48-
<li ui-sref-active="active">
49-
<a ui-sref="settings.accounts">Manage Social Accounts</a>
39+
<li ui-sref-active="active" ng-repeat="item in accountMenu.items">
40+
<a ui-sref="{{item.state}}" ng-bind="item.title"></a>
5041
</li>
5142
<li class="divider"></li>
5243
<li>

0 commit comments

Comments
 (0)