From afcc8d889fcce119edfaa8b8f7203a64b5d59e41 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sun, 2 Aug 2015 17:47:31 +0300 Subject: [PATCH 1/4] -remove project - fixed -remove user from project - in progress --- templates/js/controllers/campusesController.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index d3d5219..5acd46d 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -37,14 +37,12 @@ angular.module('SeHub') { $scope.loadingData = true; $scope.campuses = data; - console.log("INSIDE " + $scope.campuses); init(); // Executing the function to initialize campuses display }).error(function() { - // TODO + console.log(err.message); }); - // console.log($scope.campuses.length.toString()); if(!$scope.campuses) // If campuses is empty { From 6d73b98d6aabe9642c06d9b853078f1175a329ff Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sun, 2 Aug 2015 17:51:08 +0300 Subject: [PATCH 2/4] -remove project - fixed -remove user from project - in progress --- templates/js/controllers/homeController.js | 12 ++--- .../js/controllers/myProjectsController.js | 5 +- templates/js/controllers/projectController.js | 47 +++++++++++++------ templates/js/services/apiService.js | 8 ++++ templates/views/home.html | 4 +- templates/views/project.html | 21 ++++++--- 6 files changed, 62 insertions(+), 35 deletions(-) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index d269bdd..44bbcc0 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -21,28 +21,23 @@ angular.module('SeHub') if($scope.user.isLecturer) { $scope.isStudent = false; - console.log("Lecturer Mode!"); } else { $scope.isStudent = true; - console.log("Student Mode!"); } $scope.displayMessages = function() { apiService.getAllUserMessages(token).success(function(data) { - // console.log(data); $scope.userMessages = data; }).error(function(err) { - console.log("Error: " + err.message); + console.log(err.message); }); } - // $scope.displayMessages(); // - $scope.addMessageClicked = function() { $scope.addMsg = true; // Reveal the "POST" Button @@ -90,11 +85,11 @@ angular.module('SeHub') { apiService.getProjectsByCourse(token, task.courseId).success(function(data) { - console.log($scope.user); + // console.log($scope.user); for(var i = 0; i < $scope.user.projects_id_list.length; i++) for(var j = 0; j < data.length; j++) { - if($scope.user.projects_id_list[i] === data[j]) + if($scope.user.projects_id_list[i] === data[j].id.toString()) { $location.path('/tasks/fill/' + task.id + '/' + data[j].id); } @@ -111,7 +106,6 @@ angular.module('SeHub') apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK { $scope.userTasks = data; - console.log(data); }).error(function(err) { console.log(err.message); diff --git a/templates/js/controllers/myProjectsController.js b/templates/js/controllers/myProjectsController.js index 1b65c6b..08c93e0 100644 --- a/templates/js/controllers/myProjectsController.js +++ b/templates/js/controllers/myProjectsController.js @@ -5,7 +5,6 @@ angular.module('SeHub') $scope.myProjectsEmpty = true; $scope.user = $scope.$parent.user; var token = $cookies['com.sehub.www']; - console.log(token); $scope.displayMyProjects = function() { @@ -18,11 +17,9 @@ angular.module('SeHub') $scope.myProjectsEmpty = false; } init(); // Executing the function to initialize my projects display - console.log(data); - console.log("Success"); }).error(function(err) { - console.log("Error: " + err.message); + console.log(err.message); }); } diff --git a/templates/js/controllers/projectController.js b/templates/js/controllers/projectController.js index 522f67a..d2d176a 100644 --- a/templates/js/controllers/projectController.js +++ b/templates/js/controllers/projectController.js @@ -7,13 +7,25 @@ angular.module('SeHub') $scope.isEditPressed = false; $scope.user = $scope.$parent.user; $scope.loadingData = true; - $scope.isMasterOrLecturer = false; + $scope.isMaster = false; $scope.isMember = false; // $scope.thisProject = {}; // $scope.thisProject.courseName = $routeParams.className; - $scope.joinProject = function() + $scope.removeUserFromProject = function() + { + apiService.removeUserFromProject.success(function(data) + { + + }).error(function(err) + { + console.log(err.message); + }); + + } + + $scope.joinProject = function(ev) { apiService.joinProject(token, projectId).success(function(data) { @@ -30,25 +42,32 @@ angular.module('SeHub') $scope.editProject = function(ev) { - $scope.isEditPressed = true; + $scope.isEditPressed = !$scope.isEditPressed; } $scope.removeProject = function(ev) { - $mdDialog.show($mdDialog.confirm().title('Remove Project').content('Are you sure you want to remove the project ?') - .ariaLabel('Removing project alert dialog').ok('Yes').cancel('No').targetEvent(ev)); + var confirm = $mdDialog.confirm().title('Remove Project').content('Would you like to delete this project?').ariaLabel('removeProj') + .ok('Please do it!').cancel('No').targetEvent(ev); + $mdDialog.show(confirm).then(function() + { // Yes - Remove the project + console.log("Removed"); - /* - .than(function() - { - $scope.alert = 'You decided to get rid of your debt.'; + apiService.removeProject(token, projectId).success(function(data) + { + $mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removed successfully.') + .ariaLabel('project remove alert dialog').ok('Ok').targetEvent(ev)); + }).error(function(err) + { + $mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason' + err.message) + .ariaLabel('project remove alert dialog').ok('Try Again').targetEvent(ev)); + }); }, - function() - { - $scope.alert = 'You decided to keep your debt.'; + function() + { // No - Dont remove + console.log("Not removed"); + }); - */ - // $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course }; diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index f55e6cc..cd8b0df 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -197,6 +197,14 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + removeUserFromProject: function(token, userId, projectId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/removeUserFromProject/" + token + "/" + userId + "/" + projectId; + req = { + method: "DELETE", + url: url + }; + return $http(req); + }, getAllFutureTasks: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token; req = { diff --git a/templates/views/home.html b/templates/views/home.html index 2d924c4..67a2c43 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -89,7 +89,7 @@
- +
@@ -187,7 +187,7 @@
- +
diff --git a/templates/views/project.html b/templates/views/project.html index 01a9f8c..6b36e7f 100644 --- a/templates/views/project.html +++ b/templates/views/project.html @@ -19,17 +19,17 @@
- +
- +
- +
@@ -43,9 +43,18 @@
Team Members:
From 336c8354a8a7abe384d23f7d20fac40b2085048a Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Sun, 2 Aug 2015 17:54:27 +0300 Subject: [PATCH 3/4] Fixed Email --- SE_API/Email_Utils.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/SE_API/Email_Utils.py b/SE_API/Email_Utils.py index 90f2ec4..086a025 100644 --- a/SE_API/Email_Utils.py +++ b/SE_API/Email_Utils.py @@ -70,11 +70,13 @@ def send_create_campus_request(email, name, campus_name): """ message.html = """ - + + +
- +
@@ -108,11 +110,13 @@ def notify_se_hub_campus_request(campus, campus_name): """ + str(campus.to_JSON()) message.html = """ - + + +
- +
@@ -151,11 +155,12 @@ def send_task_reminder( email, name, task_name, course_name): """ message.html = """ - + + +
-
From 014fa602cb9f6169dfebfdef4b66ea161b001292 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Sun, 2 Aug 2015 18:15:51 +0300 Subject: [PATCH 4/4] Fix to task --- SE_API/Email_Utils.py | 2 +- templates/js/controllers/taskController.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SE_API/Email_Utils.py b/SE_API/Email_Utils.py index 086a025..93bc34b 100644 --- a/SE_API/Email_Utils.py +++ b/SE_API/Email_Utils.py @@ -167,7 +167,7 @@ def send_task_reminder( email, name, task_name, course_name):

Dear """+name+""":

- +

diff --git a/templates/js/controllers/taskController.js b/templates/js/controllers/taskController.js index e29a493..04f8e80 100644 --- a/templates/js/controllers/taskController.js +++ b/templates/js/controllers/taskController.js @@ -80,14 +80,15 @@ angular.module('SeHub') .content('Your Task Was Successfully Submitted!') .ariaLabel('ddd') .ok('GoTo My Submitted Task') - .then(function(dd){ + .targetEvent(event) + + ).then(function(){ if($scope.task.isPersonal) $location.path('/tasks/overview/'+taskId+'/'+groupId+'/'+groupId); else $location.path('/tasks/overview/'+taskId+'/'+groupId+'/'+groupId); - }) - .targetEvent(event) - ); + }); + return; }) }