From 0cce80ed982644ee3089b4432421ddf81cda30d9 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 24 Jun 2015 21:35:21 +0300 Subject: [PATCH] - Campuses -> Courses -> Projects -* waiting for merge to get API from server --- templates/css/theme.css | 17 ++ templates/js/app.js | 4 + templates/js/controllers/homeController.js | 8 +- .../js/controllers/myClassesController.js | 28 ++-- .../js/controllers/projectsController.js | 7 + .../js/controllers/registerController.js | 32 ++-- templates/js/services/apiService.js | 28 ++++ templates/views/index.html | 1 + templates/views/myClasses.html | 156 ++++-------------- templates/views/projects.html | 16 +- 10 files changed, 144 insertions(+), 153 deletions(-) diff --git a/templates/css/theme.css b/templates/css/theme.css index 092a58a..b697697 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -197,6 +197,18 @@ body.noscroll border-radius: 1px black solid; }*/ + .allCampusesShow + { + overflow:hidden; + background-size: auto; + + } + .campusCard + { + /*height:80%;*/ + /*width:80%;*/ + } + .gray-font { color: #7f7f7f; @@ -397,6 +409,11 @@ body.noscroll border-color: solid red; } +.cardAllCampuses +{ + word-break: break-word; +} + .addMessage { font-size: 2em; diff --git a/templates/js/app.js b/templates/js/app.js index 1ab2ed6..2210b47 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -61,6 +61,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/newCourse', { templateUrl: 'templates/views/newCourse.html', controller: 'newCourseController' + }) + .when('/campuses', { + templateUrl: 'templates/views/campuses.html', + controller: 'campusesController' }); } ]); diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 58c7c10..4dd0251 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -35,13 +35,13 @@ angular.module('SeHub') console.log("Student Mode!"); } - // apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data) + // apiService.getCourseByCampusName(token).success(function(data) // { - // console.log("Campus Name is ON! " + $scope.user.classes_id_list[0]) + // console.log("Campus Name is ON! " + token) // $scope.course = data; - // }).error(function() + // }).error(function(err) // { - // console.log("Error on ===> getCourseByCampusName") + // console.log("Error ===> " + err + " ===> getCourseByCampusName") // }); diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index d043e37..e4d69d6 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -5,7 +5,6 @@ angular.module('SeHub') $scope.isCourse = false; $scope.isNewCourse = false; $scope.newClassName = false; - // $scope.course.courseName = ''; $scope.course = {}; var token = $cookies['com.sehub.www']; $scope.user.finalDate = ''; @@ -24,6 +23,17 @@ angular.module('SeHub') } + $scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs']; + + + // apiService.getClassesByUser(token).success(function(data) // Get all the campuses + // { + // $scope.courses = data; + // }).error(function() { + // // TODO + // }); + + $scope.chooseCourseClicked = function() { $scope.isCourse = true; @@ -32,15 +42,7 @@ angular.module('SeHub') $scope.createCourseClicked = function() { - $scope.isNewCourse = true; - $scope.showMyClass = false; - console.log("create course Clicked!!"); - } - - $scope.showMyCourses = function() - { - $scope.showMyClass = true; - $scope.isNewCourse = false; + $scope.isNewCourse = !$scope.isNewCourse; } $scope.submitNewClassClicked = function() @@ -74,8 +76,10 @@ angular.module('SeHub') console.log(err); }); $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') - .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()); - // $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO + .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()) + .then(function() { + $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO + }); // Pop-up alert } else diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index 7336919..617a7a5 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -10,7 +10,14 @@ angular.module('SeHub') } + $scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs']; + // apiService.getProjectsByCourse(courseId).success(function(data) // Get all the campuses + // { + // $scope.projects = data; + // }).error(function() { + // // TODO + // }); }]); \ No newline at end of file diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 4ded290..589c5fd 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -14,26 +14,26 @@ angular.module('SeHub') var token = $rootScope.seToken; apiService.getUserByToken(token).success(function(data) // Get user token - { - $scope.user = data; + { + $scope.user = data; - if (data.message == 'No User Found') - console.error("No User Found!"); - console.log(data); + if (data.message == 'No User Found') + console.error("No User Found!"); + console.log(data); - if ($scope.user.name === ";") { - $scope.user.name = ""; - $scope.user.name = $scope.user.username; - $scope.userHasNoName = true; - } + if ($scope.user.name === ";") { + $scope.user.name = ""; + $scope.user.name = $scope.user.username; + $scope.userHasNoName = true; + } - apiService.getAllCampuses(token).success(function(data) // Get all the campuses - { - $scope.campuses = data; - }).error(function() { - // TODO - }); + apiService.getAllCampuses(token).success(function(data) // Get all the campuses + { + $scope.campuses = data; + }).error(function() { + // TODO }); + }); $scope.dropdownClicked = function() { if ($scope.campus) { diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index d3356b4..c80b38e 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -96,6 +96,34 @@ service.factory('apiService', ['$http', function($http) { url : url, data: payLoad + }; + return $http(req); + }, + getCampusesByUser: function(){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token; + req = { + method : "GET", + url : url + + }; + return $http(req); + }, + }, + getClassesByCourse: function(){ // Need to add camusName (ngRoute) ~ sagi //TODO + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token; + req = { + method : "GET", + url : url + + }; + return $http(req); + }, + getProjectsByCourse: function(){ // Need to add courseID (ngRoute) ~ sagi //TODO + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token; + req = { + method : "GET", + url : url + }; return $http(req); } diff --git a/templates/views/index.html b/templates/views/index.html index f978bb1..d168b4d 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -116,6 +116,7 @@ + \ No newline at end of file diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index 5086fbd..c3f333c 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -2,50 +2,51 @@

My Classes

+ + + +
Create Class
-
- Show My Classes -
- - - - - - - - - - -
-
- - - - - - - - - - - - -
-
- - - - -
-
+ +
+
+ + + + +
+
+ + + + + + + + + + + + +
+
+
Submit New Class @@ -57,91 +58,6 @@ {{c.course}}
-
diff --git a/templates/views/projects.html b/templates/views/projects.html index 0c03cde..d894468 100644 --- a/templates/views/projects.html +++ b/templates/views/projects.html @@ -1,6 +1,20 @@
+ +

Projects

+ + + + + -

Projects

Create Project
\ No newline at end of file