From ba5939c4378d37704d0ed54b2ca3871494e2f096 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 24 Jun 2015 14:01:08 +0300 Subject: [PATCH 1/4] - Create course api -fixed --- .../js/controllers/myClassesController.js | 36 ++++++++++++++++--- templates/js/services/apiService.js | 16 +++++++-- templates/views/myClasses.html | 26 ++++++-------- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index 879dcbb..d043e37 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -5,8 +5,11 @@ angular.module('SeHub') $scope.isCourse = false; $scope.isNewCourse = false; $scope.newClassName = false; - $scope.user.createNewCourse = ''; + // $scope.course.courseName = ''; + $scope.course = {}; + var token = $cookies['com.sehub.www']; $scope.user.finalDate = ''; + $scope.user.startDate = ''; $scope.showMyClass = false; if($scope.user.isLecturer) @@ -42,13 +45,38 @@ angular.module('SeHub') $scope.submitNewClassClicked = function() { - if($scope.user.createNewCourse != '' && $scope.user.finalDate != '') + if($scope.course.courseName != '' && $scope.course.endDate != '' && $scope.course.startDate != '') { - console.log("finalDate " + $scope.user.finalDate); - console.log($scope.user.createNewCourse); + var jsonNewCourse = + { + 'courseName': $scope.course.courseName, + 'campusName': $scope.course.campusName, + 'startDate': { + 'year' : $scope.course.startDate.getFullYear(), + 'day' : $scope.course.startDate.getDate(), + 'month': ($scope.course.startDate.getMonth() + 1) + }, + 'endDate': { + 'year' : $scope.course.endDate.getFullYear(), + 'day' : $scope.course.endDate.getDate(), + 'month': ($scope.course.endDate.getMonth() + 1) + } + }; + + console.log("Json here:"); + console.log(jsonNewCourse); + + apiService.createCourse(token, jsonNewCourse).success(function(data) + { + console.log("createCourse API done"); + }).error(function(err) + { + 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 + } else { diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index f8a877e..6c45506 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -71,7 +71,7 @@ service.factory('apiService', ['$http', function($http) { return $http(req); }, createMessage: function(token, payLoad){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseMessages/" + token; + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/createMessage/" + token; req = { method : "POST", url : url, @@ -80,12 +80,22 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getCourseMessages: function(token, courseName){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseMessages/" + token + '/' + courseName; + getMessagesByCourseName: function(token, courseName){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getMessagesByCourseName/" + token + '/' + courseName; req = { method : "GET", url : url + }; + return $http(req); + }, + createCourse: function(token, payLoad){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token; + req = { + method : "POST", + url : url, + data: payLoad + }; return $http(req); } diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index de8a765..5086fbd 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -27,28 +27,24 @@
- - + + - + + + + + - +
- - - - - - - + + +
- - - -
From 0cce80ed982644ee3089b4432421ddf81cda30d9 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 24 Jun 2015 21:35:21 +0300 Subject: [PATCH 2/4] - 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 From e2bd575ca7b5579b2b77b9cdab41e4a5d5b4ca7a Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 24 Jun 2015 21:35:55 +0300 Subject: [PATCH 3/4] - Campuses -> Courses -> Projects (Addition) -* waiting for merge to get API from server --- templates/js/controllers/campusesController.js | 17 +++++++++++++++++ templates/views/campuses.html | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 templates/js/controllers/campusesController.js create mode 100644 templates/views/campuses.html diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js new file mode 100644 index 0000000..e1d796b --- /dev/null +++ b/templates/js/controllers/campusesController.js @@ -0,0 +1,17 @@ +angular.module('SeHub') +.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { + + + + + $scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; + console.log($scope.campuses); + + // apiService.getCampusesByUser(token).success(function(data) // Get all the campuses + // { + // $scope.campuses = data; + // }).error(function() { + // // TODO + // }); + +}]); \ No newline at end of file diff --git a/templates/views/campuses.html b/templates/views/campuses.html new file mode 100644 index 0000000..96d5734 --- /dev/null +++ b/templates/views/campuses.html @@ -0,0 +1,16 @@ +
+ +

My Campuses

+
+ + + +
\ No newline at end of file From 559d235bc9cce60385024fc91c6b6b18979e0109 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Wed, 24 Jun 2015 22:43:02 +0300 Subject: [PATCH 4/4] - thisProject Added - Tasks tab system - Added --- templates/js/app.js | 4 ++ .../js/controllers/thisProjectController.js | 16 ++++++++ templates/js/services/apiService.js | 1 - templates/views/campuses.html | 8 ++-- templates/views/index.html | 1 + templates/views/projects.html | 5 +-- templates/views/tasks.html | 38 ++++++++++++++++++- templates/views/thisProject.html | 36 ++++++++++++++++++ 8 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 templates/js/controllers/thisProjectController.js create mode 100644 templates/views/thisProject.html diff --git a/templates/js/app.js b/templates/js/app.js index 2210b47..4ecf22f 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -65,6 +65,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/campuses', { templateUrl: 'templates/views/campuses.html', controller: 'campusesController' + }) + .when('/thisProject', { + templateUrl: 'templates/views/thisProject.html', + controller: 'thisProjectController' }); } ]); diff --git a/templates/js/controllers/thisProjectController.js b/templates/js/controllers/thisProjectController.js new file mode 100644 index 0000000..a1cb837 --- /dev/null +++ b/templates/js/controllers/thisProjectController.js @@ -0,0 +1,16 @@ +angular.module('SeHub') +.controller('thisProjectController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + $scope.isEditPressed = false; + + $scope.editPressed = function() + { + $scope.isEditPressed = true; + console.log("EditPressed " + $scope.isEditPressed); + } + $scope.removeProject = function() + { + console.log("Project has been removed!"); + } + +}]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index c80b38e..e619186 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -108,7 +108,6 @@ service.factory('apiService', ['$http', function($http) { }; 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 = { diff --git a/templates/views/campuses.html b/templates/views/campuses.html index 96d5734..8d0ddf8 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -2,11 +2,11 @@

My Campuses

- -