From ed4a7e2568ee938a6f5cfca5f47ad3f7b020708a Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sun, 2 Aug 2015 22:06:35 +0300 Subject: [PATCH] - team members in project - fixed --- SE_API/MessageRoutes.py | 2 +- templates/js/controllers/homeController.js | 32 ++- templates/js/controllers/projectController.js | 20 ++ templates/js/controllers/taskController.js | 2 +- templates/views/home.html | 211 ++++++++---------- templates/views/project.html | 51 +++-- 6 files changed, 181 insertions(+), 137 deletions(-) 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 @@

Dash Board

- -
- - - - - - -
- -
- -
- - -
-
- {{msg.user.username}} -
-
- {{msg.group.courseName}} - {{msg.group.projectName}} -
-
- - -
- {{msg.message}} -
- -
- - -
-
- -
- - - -
- Title: - - {{task.title}} - -

- Description: {{task.description}} -
-
-
-
- -
-
-
-
- + +
@@ -112,6 +52,51 @@
+ +
+ + + + + +
+
+ +
+
+
+ {{msg.user.username}} +
+
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
+
+
+ {{msg.message}} +
+
+
+
+
+ + + +
+ Title: + + {{task.title}} + +

+ Description: {{task.description}} +
+
+
+
+
+
+
+
@@ -127,40 +112,63 @@
Latest Message- - + {{userMessages[0].message}} + + No Messages. +
+
+
+ +
+
+
+
+ Post + Clear All +
+
+
+
+ + + + +
+
+ + {{c.courseName}} + +
+
+
- - - -
-
- -
-
-
- {{msg.user.username}} -
-
- {{msg.group.courseName}} - {{msg.group.projectName}} -
-
-
- {{msg.message}} -
+ +
+
+ +
+
+
+ {{msg.user.username}}
- - - - +
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
+
+
+ {{msg.message}} +
+
+
@@ -176,40 +184,9 @@ -
-
-
- -
-
-
-
- Post - Clear All -
-
-
-
- - - - -
-
- - {{c.courseName}} - -
-
-
\ No newline at end of file diff --git a/templates/views/project.html b/templates/views/project.html index 9bfd82f..c00a780 100644 --- a/templates/views/project.html +++ b/templates/views/project.html @@ -43,18 +43,22 @@
Team Members:
    - -
  • -
    - {{member.name}} +
    + +
    +
    + + {{member.name}} + +
    +
    + + + +
    -
    - - - -
    -
  • - + +
@@ -80,10 +84,27 @@ - -

Messages

-

Messages...

-
+ + +
+
+ +
+
+
+ {{msg.user.username}} +
+
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
+
+
+ {{msg.message}} +
+
+
+