- team members in project - fixed

This commit is contained in:
Matan Bar Yosef 2015-08-02 23:52:41 +03:00
parent ed4a7e2568
commit df3f3d4ada
4 changed files with 94 additions and 54 deletions

View file

@ -4,7 +4,6 @@ angular.module('SeHub')
{ {
$scope.isStudent = false; $scope.isStudent = false;
$scope.addMsg = false; $scope.addMsg = false;
$scope.msgToPost = "";
$scope.oldText = ""; $scope.oldText = "";
$scope.messages = []; $scope.messages = [];
$scope.userMessages = []; $scope.userMessages = [];
@ -43,8 +42,7 @@ angular.module('SeHub')
$scope.addMsg = !$scope.addMsg; // Reveal the "POST" Button $scope.addMsg = !$scope.addMsg; // Reveal the "POST" Button
} }
$scope.postMessageClicked = function() // Posting the message itself $scope.postMessageClicked = function() // Posting the message itself
{ {
console.log($scope.courseObj);
if($scope.msg.msgToAdd != null && $scope.courseObj.courseName) if($scope.msg.msgToAdd != null && $scope.courseObj.courseName)
{ {
jsonNewMsg = { jsonNewMsg = {
@ -81,13 +79,8 @@ angular.module('SeHub')
{ {
for(var i = 0; i < $scope.user.projects_id_list.length; i++) for(var i = 0; i < $scope.user.projects_id_list.length; i++)
for(var j = 0; j < data.length; j++) for(var j = 0; j < data.length; j++)
{
if($scope.user.projects_id_list[i] === data[j].id.toString()) 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); $location.path('/tasks/overview/' + task.id + '/' + data[j].id + '/' + data[j].id);
}
}
}).error(function(err) }).error(function(err)
{ {
console.log(err.message); console.log(err.message);
@ -97,7 +90,6 @@ angular.module('SeHub')
$scope.gotoTask = function(task) $scope.gotoTask = function(task)
{ {
// console.log(task);
if(task.isPersonal) if(task.isPersonal)
{ {
$location.path('/tasks/fill/' + task.id + '/' + $scope.user.id); $location.path('/tasks/fill/' + task.id + '/' + $scope.user.id);

View file

@ -12,6 +12,7 @@ angular.module('SeHub')
$scope.project = []; $scope.project = [];
$scope.isInProject = false; $scope.isInProject = false;
$scope.projectMessages = []; $scope.projectMessages = [];
$scope.msg = {};
// $scope.thisProject = {}; // $scope.thisProject = {};
// $scope.thisProject.courseName = $routeParams.className; // $scope.thisProject.courseName = $routeParams.className;
@ -26,8 +27,6 @@ angular.module('SeHub')
{ {
console.log(err.message); console.log(err.message);
}); });
} }
$scope.goToProfile = function(memberId) $scope.goToProfile = function(memberId)
@ -86,12 +85,44 @@ angular.module('SeHub')
}, },
function() function()
{ // No - Dont remove { // No - Dont remove
console.log("Not removed");
}); });
// $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course // $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) $scope.getProfileRoute = function(userName)
{ {
for(var i = 0; i < $scope.project.members.length; i++) for(var i = 0; i < $scope.project.members.length; i++)
@ -143,6 +174,7 @@ angular.module('SeHub')
console.log(err.message); console.log(err.message);
}); });
} }
$scope.getProjectInfo(); // Get all this project data
$scope.displayProjectMessages(); // Display all messages in project $scope.displayProjectMessages(); // Display all messages in project
$scope.getProjectInfo(); // Get all this project data
}]); }]);

View file

@ -121,30 +121,29 @@
</div> </div>
</div> </div>
<div class ="addMessage" layout="row" layout-margin layout padding> <div class ="addMessage" layout="row" layout-margin layout padding>
<div> <div>
<md-button ng-click="addMessageClicked()" ng class="md-raised md-primary" aria-label="aM"><i class="fa fa-comments"></i></md-button> <md-button ng-click="addMessageClicked()" ng class="md-raised md-primary" aria-label="aM"><i class="fa fa-comments"></i></md-button>
</div> </div>
</div> </div>
<div ng-if="addMsg"> <div ng-if="addMsg">
<div layout = "row" layout-margin layout padding layout-align = "left center"> <div layout = "row" layout-margin layout padding layout-align = "left center">
<md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button> <md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</md-button> </div>
</div> <div class="port_spacer"></div>
<div class="port_spacer"></div> <div layout-padding layout = "row">
<div layout-padding layout = "row"> <div flex = "60">
<div flex = "60"> <md-input-container>
<md-input-container> <label> Write Your Desired Message Here And Press Post</label>
<label> Write Your Desired Message Here And Press Post</label> <input type="text" minlength="1" ng-model="msg.msgToAdd" required></input>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required></input> </md-input-container>
</md-input-container> </div>
</div> <div flex = "30">
<div flex = "30"> <md-select placeholder="Choose Course" ng-model="courseObj.name" ng-change="chooseCourseClicked()" style="z-index: 300" class="courseDropDown" required>
<md-select placeholder="Choose Course" ng-model="courseObj.name" ng-change="chooseCourseClicked()" style="z-index: 300" class="courseDropDown" required> <md-option ng-repeat="c in courses" value="{{c.courseName}}">{{c.courseName}}</md-option>
<md-option ng-repeat="c in courses" value="{{c.courseName}}">{{c.courseName}}</md-option> </md-select>
</md-select>
</div>
</div> </div>
</div> </div>
</div>
<md-content> <md-content>
<md-card> <md-card>
<div flex="100"> <div flex="100">

View file

@ -77,6 +77,25 @@
</div> </div>
</div> </div>
</md-card> </md-card>
<div class ="addMessage" layout="row" layout-margin layout padding>
<div>
<md-button ng-click="addMessageClicked()" ng class="md-raised md-primary" aria-label="aM"><i class="fa fa-comments"></i></md-button>
</div>
</div>
<div ng-if="addMsg">
<div layout = "row" layout-margin layout padding layout-align = "left center">
<md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button>
</div>
<div class="port_spacer"></div>
<div layout-padding layout = "row">
<div flex = "60">
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required></input>
</md-input-container>
</div>
</div>
</div>
<div> <div>
<div flex = "96" style="height:70%;"> <div flex = "96" style="height:70%;">
<div flex> <div flex>
@ -84,27 +103,25 @@
<md-content class="md-padding"> <md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom> <md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages"> <md-tab label="Messages">
<!-- <md-content class="md-padding"> --> <md-card ng-repeat = "msg in userMessages">
<md-card ng-repeat = "msg in userMessages"> <div layout = "column" layout-padding>
<div layout = "column" layout-padding> <div flex = "30" class="md-avatar">
<div flex = "30" class="md-avatar"> <img ng-src="{{msg.user.avatar_url}}" style="width:100%">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%"> </div>
<div flex = "20" layout = "row">
<div>
{{msg.user.username}}
</div> </div>
<div flex = "20" layout = "row"> <div>
<div> {{msg.group.courseName}}
{{msg.user.username}} {{msg.group.projectName}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = "40">
{{msg.message}}
</div> </div>
</div> </div>
</md-card> <div flex = "40">
<!-- </md-content> --> {{msg.message}}
</div>
</div>
</md-card>
</md-tab> </md-tab>
<md-tab label="Commits"> <md-tab label="Commits">
<md-content class="tabDesign"> <md-content class="tabDesign">