From afb9c3818459faea3276ee56cf0711823ae52ebe Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Mon, 3 Aug 2015 01:01:25 +0300 Subject: [PATCH] - in progress --- templates/js/controllers/homeController.js | 1 + templates/js/controllers/projectController.js | 21 +++++-- templates/views/project.html | 59 ++++++++++--------- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 0e617e3..6582e2e 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -118,6 +118,7 @@ angular.module('SeHub') apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK { $scope.userTasks = data; + console.log($scope.userTasks); }).error(function(err) { console.log(err.message); diff --git a/templates/js/controllers/projectController.js b/templates/js/controllers/projectController.js index 3312242..5d61c1c 100644 --- a/templates/js/controllers/projectController.js +++ b/templates/js/controllers/projectController.js @@ -7,35 +7,41 @@ angular.module('SeHub') $scope.isEditPressed = false; $scope.user = $scope.$parent.user; $scope.loadingData = true; + $scope.displayingMessages = true; $scope.isMaster = false; $scope.isMember = false; $scope.project = []; $scope.isInProject = false; $scope.projectMessages = []; $scope.msg = {}; + $scope.isMaster = false; // $scope.thisProject = {}; // $scope.thisProject.courseName = $routeParams.className; + + console.log($scope.user.id) + // console.log($scope.projectid) $scope.displayProjectMessages = function() { apiService.getAllUserMessages(token).success(function(data) { - $scope.projectMessages = data; + $scope.displayingMessages = false; + $scope.projectMessages = data; }).error(function(err) { - console.log(err.message); + console.log(err.message); }); } $scope.goToProfile = function(memberId) { - $location.path('#/profile/' + memberId); + $location.path('/profile/' + memberId); } $scope.removeUserFromProject = function() { - apiService.removeUserFromProject.success(function(data) + apiService.removeUserFromProject(token, $scope.user.id, projectId).success(function(data) { }).error(function(err) @@ -66,6 +72,9 @@ angular.module('SeHub') $scope.removeProject = function(ev) { + if($scope.user.id === $scope.project.master_id) + $scope.isMaster = true; + 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() @@ -79,7 +88,7 @@ angular.module('SeHub') $location.path('/myProjects'); }).error(function(err) { - $mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason' + err.message) + $mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason ' + err.message) .ariaLabel('project remove alert dialog').ok('Try Again').targetEvent(ev)); }); }, @@ -141,6 +150,8 @@ angular.module('SeHub') apiService.getProjectsById(token, projectId).success(function(data) { $scope.project = data; + if($scope.user.id === $scope.project.master_id) + $scope.isMaster = true; for(var i = 0; i < data.members.length; i++) { if($scope.user.id === data.members[i].id) diff --git a/templates/views/project.html b/templates/views/project.html index 5c10ac8..02e5f3a 100644 --- a/templates/views/project.html +++ b/templates/views/project.html @@ -44,20 +44,20 @@ Team Members: @@ -100,28 +100,33 @@
- + - -
-
- -
-
-
- {{msg.user.username}} +
+ +
+ + +
+
+
-
- {{msg.group.courseName}} - {{msg.group.projectName}} +
+
+ {{msg.user.username}} +
+
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
+
+
+ {{msg.message}}
-
- {{msg.message}} -
-
-
+ +
@@ -191,12 +196,12 @@ - +