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

Commit

Permalink
Fixing Header Active items
Browse files Browse the repository at this point in the history
  • Loading branch information
amoshaviv committed May 22, 2014
1 parent 6455bdc commit 3cc8caf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.2.0",
"grunt-ngmin": "0.0.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-nodemon": "~0.2.1",
"grunt-concurrent": "~0.5.0",
"grunt-mocha-test": "~0.10.0",
"grunt-ngmin": "0.0.3",
"grunt-karma": "~0.8.2",
"load-grunt-tasks": "~0.4.0",
"karma": "~0.12.0",
Expand Down
2 changes: 1 addition & 1 deletion public/modules/articles/config/articles.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
angular.module('articles').run(['Menus',
function(Menus) {
// Set top bar menu items
Menus.addMenuItem('topbar', 'Articles', 'articles', 'dropdown');
Menus.addMenuItem('topbar', 'Articles', 'articles', 'dropdown', '/articles(/create)?');
Menus.addSubMenuItem('topbar', 'articles', 'List Articles', 'articles');
Menus.addSubMenuItem('topbar', 'articles', 'New Article', 'articles/create');
}
Expand Down
5 changes: 3 additions & 2 deletions public/modules/core/services/menus.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ angular.module('core').service('Menus', [
};

// Add menu item object
this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuClass, menuItemUIRoute, isPublic, roles) {
this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemType, menuItemUIRoute, isPublic, roles) {
// Validate that the menu exists
this.validateMenuExistance(menuId);

// Push new menu item
this.menus[menuId].items.push({
title: menuItemTitle,
link: menuItemURL,
menuClass: menuClass || '',
menuItemType: menuItemType || 'item',
menuItemClass: menuItemType,
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
isPublic: isPublic || this.menus[menuId].isPublic,
roles: roles || this.defaultRoles,
Expand Down
2 changes: 1 addition & 1 deletion public/modules/core/views/header.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation">
<ul class="nav navbar-nav" data-ng-if="menu.shouldRender(authentication.user);">
<li data-ng-repeat="item in menu.items" data-ng-if="item.shouldRender(authentication.user);" ng-switch="item.menuClass" class="{{item.menuClass}}" ui-route="{{item.uiRoute}}" ng-class="{active: $uiRoute}">
<li data-ng-repeat="item in menu.items" data-ng-if="item.shouldRender(authentication.user);" ng-switch="item.menuItemType" ui-route="{{item.uiRoute}}" ng-class="{active: ($uiRoute), '{{item.menuItemClass}}': item.menuItemClass}">
<a ng-switch-when="dropdown" href="#" class="dropdown-toggle" data-toggle="dropdown">
<span data-ng-bind="item.title"></span>
<b class="caret"></b>
Expand Down

0 comments on commit 3cc8caf

Please sign in to comment.