Routes scaffolding figured out

This commit is contained in:
Fergal Moran
2014-03-21 22:04:25 +00:00
parent 7ccc745eb7
commit d4e760aee7
15 changed files with 26 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp', [
angular.module('robotoPromotoApp', [
'ngCookies',
'ngResource',
'ngSanitize',
@@ -25,6 +25,10 @@ angular.module('robotoApp', [
controller: 'SettingsCtrl',
authenticate: true
})
.when('/promotions', {
templateUrl: 'partials/promotions',
controller: 'PromotionsCtrl'
})
.otherwise({
redirectTo: '/'
});
@@ -55,4 +59,4 @@ angular.module('robotoApp', [
$location.path('/login');
}
});
});
});

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.controller('LoginCtrl', function ($scope, Auth, $location) {
$scope.user = {};
$scope.errors = {};

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.controller('MainCtrl', function ($scope, $http) {
$http.get('/api/awesomeThings').success(function(awesomeThings) {
$scope.awesomeThings = awesomeThings;

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.controller('NavbarCtrl', function ($scope, $location, Auth) {
$scope.menu = [{
'title': 'Home',

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.controller('SettingsCtrl', function ($scope, User, Auth) {
$scope.errors = {};

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.controller('SignupCtrl', function ($scope, Auth, $location) {
$scope.user = {};
$scope.errors = {};

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
/**
* Removes server error when user updates input

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.factory('Auth', function Auth($location, $rootScope, Session, User, $cookieStore) {
// Get currentUser from cookie

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.factory('Session', function ($resource) {
return $resource('/api/session/');
});

View File

@@ -1,6 +1,6 @@
'use strict';
angular.module('robotoApp')
angular.module('robotoPromotoApp')
.factory('User', function ($resource) {
return $resource('/api/users/:id', {
id: '@id'

View File

@@ -17,9 +17,10 @@
<!-- endbuild -->
<!-- build:css({.tmp,app}) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="bower_components/ng-grid/ng-grid.min.css"></link>
<!-- endbuild -->
</head>
<body ng-app="robotoApp">
<body ng-app="robotoPromotoApp">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
@@ -57,6 +58,7 @@
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/navbar.js"></script>
<script src="scripts/controllers/promotions.js"></script>
<script src="scripts/controllers/login.js"></script>
<script src="scripts/controllers/signup.js"></script>
<script src="scripts/controllers/settings.js"></script>

View File

@@ -3,6 +3,7 @@
<li ng-repeat="item in menu" ng-class="{active: isActive(item.link)}">
<a ng-href="{{item.link}}">{{item.title}}</a>
</li>
<li ng-hide="currentUser" ng-class="{active: isActive('/promotions')}"><a href="/promotions">Promotions</a></li>
<li ng-hide="currentUser" ng-class="{active: isActive('/login')}"><a href="/login">Login</a></li>
<li ng-hide="currentUser" ng-class="{active: isActive('/signup')}"><a href="/signup">Sign up</a></li>
<li ng-show="currentUser" ng-class="{active: isActive('/logout')}"><a href="" ng-click="logout()">Logout</a></li>