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}} +
+
+