Merge: nitweb: add READMEs summaries
[nit.git] / share / nitweb / javascripts / nitweb.js
index 94c9d9a..78f0f71 100644 (file)
  */
 
 (function() {
-       angular.module('nitweb', ['ngRoute', 'ngSanitize', 'entities', 'index'])
-
+       angular.module('nitweb', ['ngRoute', 'ngSanitize', 'angular-loading-bar', 'entities', 'docdown', 'index', 'metrics', 'users', 'grades'])
+       .config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
+               cfpLoadingBarProvider.includeSpinner = false;
+       }])
        .config(function($routeProvider, $locationProvider) {
                $routeProvider
                        .when('/', {
                                controller: 'IndexCtrl',
                                controllerAs: 'indexCtrl'
                        })
+                       .when('/user', {
+                               templateUrl: 'views/user.html',
+                               controller: 'UserCtrl',
+                               controllerAs: 'userCtrl'
+                       })
+                       .when('/docdown', {
+                               templateUrl: 'views/docdown.html',
+                               controller: 'DocdownCtrl',
+                               controllerAs: 'docdownCtrl'
+                       })
+                       .when('/grades', {
+                               templateUrl: 'views/grades.html',
+                               controller: 'GradesCtrl',
+                               controllerAs: 'gradesCtrl'
+                       })
+                       .when('/login', {
+                               controller : function(){
+                                       window.location.replace('/login');
+                               },
+                           template : "<div></div>"
+                       })
+                       .when('/logout', {
+                               controller : function(){
+                                       window.location.replace('/logout');
+                               },
+                           template : "<div></div>"
+                       })
                        .when('/doc/:id', {
                                templateUrl: 'views/doc.html',
                                controller: 'EntityCtrl',
-                               controllerAs: 'entityCtrl'
+                               controllerAs: 'entityCtrl',
+                               reloadOnSearch: false
                        })
                        .otherwise({
-                               redirectTo: '/'
+                               templateUrl: 'views/error.html'
                        });
                $locationProvider.html5Mode(true);
+       })
+
+       .filter('encodeURI', function() {
+               return encodeURIComponent;
        });
 })();