-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d43c89
commit 721b7cb
Showing
9 changed files
with
107 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
angular.module('angularCmsApp') | ||
.controller 'SidebarCtrl', ($scope, $rootScope) -> | ||
$scope.awesomeThings = [ | ||
'HTML5 Boilerplate' | ||
'AngularJS' | ||
'Karma' | ||
] | ||
|
||
$scope.items = $rootScope.App.menu.user | ||
$scope.selected = null | ||
|
||
$scope.select = (item) -> | ||
angular.forEach $rootScope.App.menu.admin, (item) -> | ||
item.selected = false | ||
console.log item | ||
angular.forEach $rootScope.App.menu.user, (item) -> | ||
item.selected = false | ||
console.log item | ||
|
||
item.selected = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
<div class="well well-sm sidebar-nav"> | ||
<div class="well well-sm sidebar-nav" ng-controller="SidebarCtrl"> | ||
<nav class="nav nav-list"> | ||
<li class="nav-header">Menu</li> | ||
<li ng-repeat="item in App.menu.user" ng-include src="'menu-item.html'"></li> | ||
<li | ||
ng-class="{active:item.selected}" | ||
ng-repeat="item in App.menu.user" | ||
ng-include src="'sidebar-item.html'"></li> | ||
<li class="nav-header">Admin</li> | ||
<li ng-repeat="item in App.menu.admin" ng-include src="'menu-item.html'"></li> | ||
<li | ||
ng-class="{active:item.selected}" | ||
ng-repeat="item in App.menu.admin" | ||
ng-include src="'sidebar-item.html'"></li> | ||
</nav> | ||
</div> | ||
</div> | ||
|
||
<script id="sidebar-item.html" type="text/ng-template"> | ||
<a | ||
ng-click="select(item)" | ||
ng-href="#{{item.href}}"> | ||
<i class="fa fa-1x fa-{{item.icon}}"></i> | ||
{{item.title}} | ||
</a> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict' | ||
|
||
describe 'Controller: SidebarCtrl', () -> | ||
|
||
# load the controller's module | ||
beforeEach module 'angularCmsApp' | ||
|
||
SidebarCtrl = {} | ||
scope = {} | ||
|
||
# Initialize the controller and a mock scope | ||
beforeEach inject ($controller, $rootScope) -> | ||
scope = $rootScope.$new() | ||
SidebarCtrl = $controller 'SidebarCtrl', { | ||
$scope: scope | ||
} | ||
|
||
it 'should attach a list of awesomeThings to the scope', () -> | ||
expect(scope.awesomeThings.length).toBe 3 |