*/
(function() {
- angular.module('nitweb', ['ngRoute', 'ngSanitize', 'angular-loading-bar', 'entities', 'docdown', 'index', 'metrics', 'users', 'grades'])
+ angular.module('nitweb', ['ui.router', 'ngSanitize', 'angular-loading-bar', 'index', 'entities', 'docdown', 'metrics', 'users', 'grades'])
+
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
cfpLoadingBarProvider.includeSpinner = false;
}])
- .config(function($routeProvider, $locationProvider) {
- $routeProvider
- .when('/', {
- templateUrl: 'views/index.html',
- controller: 'IndexCtrl',
- controllerAs: 'indexCtrl'
- })
- .when('/user', {
+
+ .run(['$anchorScroll', function($anchorScroll) {
+ $anchorScroll.yOffset = 80;
+ }])
+
+ .config(function($stateProvider, $locationProvider) {
+ $stateProvider
+ .state('user', {
+ url: '/user',
templateUrl: 'views/user.html',
controller: 'UserCtrl',
controllerAs: 'userCtrl'
})
- .when('/docdown', {
+ .state('docdown', {
+ url: '/docdown',
templateUrl: 'views/docdown.html',
controller: 'DocdownCtrl',
controllerAs: 'docdownCtrl'
})
- .when('/grades', {
+ .state('grades', {
+ url: '/grades',
templateUrl: 'views/grades.html',
controller: 'GradesCtrl',
controllerAs: 'gradesCtrl'
})
- .when('/login', {
+ .state('login', {
+ url: '/login',
controller : function(){
window.location.replace('/login');
},
template : "<div></div>"
})
- .when('/logout', {
+ .state('logout', {
controller : function(){
window.location.replace('/logout');
},
template : "<div></div>"
})
- .when('/doc/:id', {
+ .state('doc', {
+ url: '/doc/:id',
templateUrl: 'views/doc.html',
controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
+ controllerAs: 'entityCtrl',
})
- .otherwise({
+ .state({
+ name: '404',
+ url: '*path',
templateUrl: 'views/error.html'
- });
+ })
$locationProvider.html5Mode(true);
+ })
+
+ .filter('encodeURI', function() {
+ return encodeURIComponent;
});
})();