se-hub/templates/js/app.js

87 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2015-06-09 17:16:29 +00:00
var DEBUG = true;
2015-05-09 19:00:14 +00:00
var welcome = angular.module('welcome', ['ngMaterial', 'seHub.services', 'ngRoute' , 'ngCookies']);
var app = angular.module('SeHub', ['ngMaterial', 'ngRoute', 'seHub.services', 'ngCookies', 'chart.js', '720kb.datepicker']);
2015-05-09 19:00:14 +00:00
welcome.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('teal');
});
welcome.controller('welcomeController', ['$scope', 'apiService', '$cookies', '$window', function($scope, apiService, $cookies, $window) {
console.log("Welcome Controller");
var uid = $cookies['com.sehub.www'];
if(uid){
console.info("Session in Place");
2015-05-09 19:00:14 +00:00
$window.location.href = DEBUG ? 'http://localhost:8080/home' : 'http://se-hub.appspot.com/home';
}
2015-05-09 19:00:14 +00:00
}]);
app.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'templates/views/home.html'
2015-05-09 19:00:14 +00:00
})
.when('/register', {
templateUrl: 'templates/views/register.html',
controller: 'registerController'
})
.when('/home', {
templateUrl: 'templates/views/home.html',
controller: 'homeController'
})
.when('/profile/:id', {
templateUrl: 'templates/views/profile.html',
controller: 'profileController'
})
.when('/tasks', {
templateUrl: 'templates/views/tasks.html',
controller: 'tasksController'
})
.when('/myClasses/:campusId', {
templateUrl: 'templates/views/myClasses.html',
controller: 'myClassesController'
2015-06-22 10:16:38 +00:00
})
2015-06-22 10:04:21 +00:00
.when('/tasks/new', {
templateUrl: 'templates/views/newTask.html',
controller: 'newTasksController'
})
.when('/tasks/overview/:taskId/:submitterId/:gId', {
templateUrl: 'templates/views/task.html',
controller: 'taskController'
})
.when('/tasks/fill/:taskId/:gId', {
templateUrl: 'templates/views/task.html',
controller: 'taskController'
})
.when('/class/:classId/:className', {
2015-06-29 16:20:56 +00:00
templateUrl: 'templates/views/class.html',
controller: 'classController'
})
.when('/newCourse', {
templateUrl: 'templates/views/newCourse.html',
controller: 'newCourseController'
})
.when('/campuses', {
templateUrl: 'templates/views/campuses.html',
controller: 'campusesController'
})
2015-06-29 16:20:56 +00:00
.when('/project/:projectId', {
templateUrl: 'templates/views/project.html',
controller: 'projectController'
})
.when('/myProjects', {
templateUrl: 'templates/views/myProjects.html',
controller: 'myProjectsController'
2015-05-09 19:00:14 +00:00
});
}
]);
app.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('teal')
.accentPalette('blue-grey');
});