From ed4a7e2568ee938a6f5cfca5f47ad3f7b020708a Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sun, 2 Aug 2015 22:06:35 +0300 Subject: [PATCH 1/2] - 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}} +
+
+
+
From df3f3d4adaba8a7f287e97f77aecc15846283f34 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sun, 2 Aug 2015 23:52:41 +0300 Subject: [PATCH 2/2] - team members in project - fixed --- templates/js/controllers/homeController.js | 10 +--- templates/js/controllers/projectController.js | 42 +++++++++++++-- templates/views/home.html | 43 ++++++++------- templates/views/project.html | 53 ++++++++++++------- 4 files changed, 94 insertions(+), 54 deletions(-) diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index a7fea8c..0e617e3 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -4,7 +4,6 @@ angular.module('SeHub') { $scope.isStudent = false; $scope.addMsg = false; - $scope.msgToPost = ""; $scope.oldText = ""; $scope.messages = []; $scope.userMessages = []; @@ -43,8 +42,7 @@ angular.module('SeHub') $scope.addMsg = !$scope.addMsg; // Reveal the "POST" Button } $scope.postMessageClicked = function() // Posting the message itself - { - console.log($scope.courseObj); + { if($scope.msg.msgToAdd != null && $scope.courseObj.courseName) { jsonNewMsg = { @@ -81,13 +79,8 @@ angular.module('SeHub') { 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); @@ -97,7 +90,6 @@ angular.module('SeHub') $scope.gotoTask = function(task) { - // console.log(task); if(task.isPersonal) { $location.path('/tasks/fill/' + task.id + '/' + $scope.user.id); diff --git a/templates/js/controllers/projectController.js b/templates/js/controllers/projectController.js index 23e139b..3312242 100644 --- a/templates/js/controllers/projectController.js +++ b/templates/js/controllers/projectController.js @@ -12,6 +12,7 @@ angular.module('SeHub') $scope.project = []; $scope.isInProject = false; $scope.projectMessages = []; + $scope.msg = {}; // $scope.thisProject = {}; // $scope.thisProject.courseName = $routeParams.className; @@ -26,8 +27,6 @@ angular.module('SeHub') { console.log(err.message); }); - - } $scope.goToProfile = function(memberId) @@ -86,12 +85,44 @@ angular.module('SeHub') }, function() { // No - Dont remove - console.log("Not removed"); - }); // $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course }; + $scope.addMessageClicked = function() + { + $scope.addMsg = !$scope.addMsg; // Reveal the "POST" Button + } + $scope.postMessageClicked = function() // Posting the message itself + { + if($scope.msg.msgToAdd != null) + { + // console.log(msg.msgToAdd); + jsonNewMsg = { + 'groupId': parseInt(projectId), // TODO Should be ===> $scope.courseObj.id + 'message': $scope.msg.msgToAdd, + 'isProject': true + }; + console.log(jsonNewMsg.message); + console.log(jsonNewMsg.groupId); + console.log(jsonNewMsg.isProject); + + apiService.createMessage(token, jsonNewMsg).success(function(data) + { + $scope.projectMessages.push(data); + }).error(function(err) + { + console.log(err.message); + }); + } + else + { + $mdDialog.show($mdDialog.alert().title('Error Creating Message').content('Message content or Course is missing') + .ariaLabel('Send Message alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert + } + $scope.msg.msgToAdd = null; + } + $scope.getProfileRoute = function(userName) { for(var i = 0; i < $scope.project.members.length; i++) @@ -143,6 +174,7 @@ angular.module('SeHub') console.log(err.message); }); } - $scope.getProjectInfo(); // Get all this project data $scope.displayProjectMessages(); // Display all messages in project + $scope.getProjectInfo(); // Get all this project data + }]); \ No newline at end of file diff --git a/templates/views/home.html b/templates/views/home.html index e7e62ef..24618b9 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -121,30 +121,29 @@
-
- -
-
-
-
- Post - Clear All -
-
-
-
- - - - -
-
- - {{c.courseName}} - -
+
+ +
+
+
+
+ Post +
+
+
+
+ + + + +
+
+ + {{c.courseName}} +
+
diff --git a/templates/views/project.html b/templates/views/project.html index c00a780..5c10ac8 100644 --- a/templates/views/project.html +++ b/templates/views/project.html @@ -77,6 +77,25 @@
+
+
+ +
+
+
+
+ Post +
+
+
+
+ + + + +
+
+
@@ -84,27 +103,25 @@ - - -
-
- + +
+
+ +
+
+
+ {{msg.user.username}}
-
-
- {{msg.user.username}} -
-
- {{msg.group.courseName}} - {{msg.group.projectName}} -
-
-
- {{msg.message}} +
+ {{msg.group.courseName}} + {{msg.group.projectName}}
- - +
+ {{msg.message}} +
+
+