diff --git a/SE_API/MessageRoutes.py b/SE_API/MessageRoutes.py index cb3eee1..2ed4f60 100644 --- a/SE_API/MessageRoutes.py +++ b/SE_API/MessageRoutes.py @@ -92,7 +92,7 @@ def createMessage(token): db.put(msg) db.save - return Response(response=json.dumps(msg), + return Response(response=msg.to_JSON(), status=200, mimetype="application/json") diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index b0d3d59..a7fea8c 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -40,7 +40,7 @@ angular.module('SeHub') $scope.addMessageClicked = function() { - $scope.addMsg = true; // Reveal the "POST" Button + $scope.addMsg = !$scope.addMsg; // Reveal the "POST" Button } $scope.postMessageClicked = function() // Posting the message itself { @@ -68,9 +68,36 @@ angular.module('SeHub') $scope.msg.msgToAdd = null; } + $scope.reviewTask = function(task) + { + //tasks/overview/:taskId/:submitterId/:gId', { + if(task.isPersonal) // As Lecturer + { + $location.path('/tasks/overview/' + task.id + '/' + $scope.user.id + '/' + $scope.user.id); + } + else // it's a project task + { + apiService.getProjectsByCourse(token, task.courseId).success(function(data) + { + 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].id.toString()) + { + // $location.path('/tasks/fill/' + task.id + '/' + data[j].id); + $location.path('/tasks/overview/' + task.id + '/' + data[j].id + '/' + data[j].id); + } + } + }).error(function(err) + { + console.log(err.message); + }); + } + } + $scope.gotoTask = function(task) { - console.log(task); + // console.log(task); if(task.isPersonal) { $location.path('/tasks/fill/' + task.id + '/' + $scope.user.id); @@ -130,7 +157,6 @@ angular.module('SeHub') { console.log(err.message); }); - } $scope.getCourses = function() diff --git a/templates/js/controllers/projectController.js b/templates/js/controllers/projectController.js index 8757136..23e139b 100644 --- a/templates/js/controllers/projectController.js +++ b/templates/js/controllers/projectController.js @@ -11,10 +11,29 @@ angular.module('SeHub') $scope.isMember = false; $scope.project = []; $scope.isInProject = false; + $scope.projectMessages = []; // $scope.thisProject = {}; // $scope.thisProject.courseName = $routeParams.className; + + $scope.displayProjectMessages = function() + { + apiService.getAllUserMessages(token).success(function(data) + { + $scope.projectMessages = data; + }).error(function(err) + { + console.log(err.message); + }); + + + } + + $scope.goToProfile = function(memberId) + { + $location.path('#/profile/' + memberId); + } $scope.removeUserFromProject = function() { apiService.removeUserFromProject.success(function(data) @@ -125,4 +144,5 @@ angular.module('SeHub') }); } $scope.getProjectInfo(); // Get all this project data + $scope.displayProjectMessages(); // Display all messages in project }]); \ No newline at end of file diff --git a/templates/js/controllers/taskController.js b/templates/js/controllers/taskController.js index ea62d41..1179bdf 100644 --- a/templates/js/controllers/taskController.js +++ b/templates/js/controllers/taskController.js @@ -21,7 +21,7 @@ angular.module('SeHub') $scope.isMaster = (user.id === data.master_id); }); if (!data.isPersonal) { - apiService.getProjectsById(token, groupId).sucsess(function(data) { + apiService.getProjectsById(token, groupId).success(function(data) { $scope.group = data; }); } else { diff --git a/templates/views/home.html b/templates/views/home.html index 67a2c43..e7e62ef 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -26,70 +26,10 @@
Messages...
-