diff --git a/templates/js/app.js b/templates/js/app.js index 9fb2986..1ab2ed6 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -57,6 +57,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/projects', { templateUrl: 'templates/views/projects.html', controller: 'projectsController' + }) + .when('/newCourse', { + templateUrl: 'templates/views/newCourse.html', + controller: 'newCourseController' }); } ]); diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 9a13dbb..58c7c10 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -6,17 +6,28 @@ angular.module('SeHub') $scope.msgToPost = ""; $scope.oldText = ""; $scope.messages = []; + $scope.msg = {}; + + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; var imagePath = $scope.user.avatar_url; + //var campusName = ''; + $scope.course = ''; + // $scope.campusName = ''; + $scope.phones = [ { type: 'Home', number: '(972) 865-82861' }, { type: 'Cell', number: '(972) 5251-32309' }, ]; + + if($scope.user.isLecturer) { $scope.isStudent = false; console.log("Lecturer Mode!"); + // console.log($scope.campusName); } else { @@ -24,12 +35,20 @@ angular.module('SeHub') console.log("Student Mode!"); } + // apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data) + // { + // console.log("Campus Name is ON! " + $scope.user.classes_id_list[0]) + // $scope.course = data; + // }).error(function() + // { + // console.log("Error on ===> getCourseByCampusName") + // }); + + $scope.addMessageClicked = function() { $scope.addMsg = true; // Reveal the "POST" Button } - - $scope.msg = {}; $scope.postMessageClicked = function() // Posting the message itself { if($scope.msg.msgToAdd != null) @@ -48,14 +67,11 @@ angular.module('SeHub') $scope.chooseCourseClicked = function() { console.log("choose course Clicked!!"); - - } $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); - } diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 6ce4d08..279fddd 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -26,7 +26,7 @@ angular.module('SeHub') if($scope.user.name === ";") { $scope.user.name = ""; - $scope.user.name = $scope.user.username + $scope.user.name = $scope.user.username; $scope.userHasNoName = true; } diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 276fa04..d6d1a03 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -1,3 +1,4 @@ + var DEBUG = true; var service = angular.module('seHub.services', []); @@ -42,6 +43,16 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getCourseByCampusName: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; + req = { + method : "GET", + url : url, + data: token + + }; + return $http(req); + }, getAllCourses: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; req = { diff --git a/templates/views/home.html b/templates/views/home.html index 8f8902f..980eaa6 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -88,8 +88,10 @@ -