- team members in project - fixed

This commit is contained in:
Matan Bar Yosef 2015-08-02 22:06:35 +03:00
parent f83aff5408
commit ed4a7e2568
6 changed files with 181 additions and 137 deletions

View file

@ -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")

View file

@ -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()

View file

@ -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
}]);

View file

@ -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 {

View file

@ -26,70 +26,10 @@
<h1 style="margin-left:15px;"><i class="fa fa-dashboard"></i> Dash Board</h1>
</md-content>
<div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<md-card>
<div flex = "90">
<md-content>
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages">
<md-content class="tabDesign">
<!-- <md-content class="messagesContent"> -->
<md-card ng-repeat = "msg in userMessages">
<div layout = "column" layout-padding>
<!-- <div> -->
<div flex = "30" class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<!-- </div> -->
<!-- <div> -->
<div flex = "20" layout = "row">
<div>
{{msg.user.username}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<!-- </div> -->
<!-- <div> -->
<div flex = "40">
{{msg.message}}
</div>
<!-- </div> -->
</div>
<!---->
</md-card>
</md-content>
<!-- </md-content> -->
</md-tab>
<md-tab label="Tasks waiting for review">
<md-content class="md-padding">
<md-card ng-repeat = "task in userTasks" layout-padding>
<div>
Title:
<md-button ng-click="gotoTask(task)">
{{task.title}}
</md-button>
<br></br>
Description: {{task.description}}
</div>
</md-card>
</md-content>
</md-tab>
<!-- <md-tab label="two">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
Two
</md-content>
</md-tab> -->
</md-tabs>
</md-content>
</div>
</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>
<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">
@ -112,6 +52,51 @@
</div>
</div>
</div>
<md-card>
<div flex = "90">
<md-content>
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages">
<md-content class="tabDesign">
<md-card ng-repeat = "msg in userMessages">
<div layout = "row" layout-padding>
<div flex = "10">
<img ng-src="{{msg.user.avatar_url}}" style="width:80%">
</div>
<div flex = "20" layout = "column">
<div>
{{msg.user.username}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = "40">
{{msg.message}}
</div>
</div>
</md-card>
</md-content>
</md-tab>
<md-tab label="Tasks waiting for review">
<md-content class="md-padding">
<md-card ng-repeat = "task in userTasks" layout-padding>
<div>
Title:
<md-button ng-click="reviewTask(task)">
{{task.title}}
</md-button>
<br></br>
Description: {{task.description}}
</div>
</md-card>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</div>
</md-card>
</div>
<div ng-if="isStudent"> <!-- Student Mode -->
<div layout = "column" flex = 90 layout-margin>
@ -127,40 +112,63 @@
</div>
<div>
Latest Message-
<md-card layout-margin layout-padding>
<md-card layout-margin layout-padding ng-if="!userMessages">
{{userMessages[0].message}}
</md-card>
<md-card layout-margin layout-padding ng-if="userMessages">
No Messages.
</md-card>
</div>
</div>
<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>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</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 flex = "30">
<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-select>
</div>
</div>
</div>
<md-content>
<md-card>
<div flex="100">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages">
<md-content class="tabDesign">
<md-content class="messagesContent">
<md-card ng-repeat = "msg in userMessages">
<div layout = "column" layout-padding>
<div flex = "30" class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<div flex = "20" layout = "row">
<div>
{{msg.user.username}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = "40">
{{msg.message}}
</div>
<md-card ng-repeat = "msg in userMessages">
<div layout = "column" layout-padding>
<div flex = "30" class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<div flex = "20" layout = "row">
<div>
{{msg.user.username}}
</div>
</md-card>
</md-content>
<!-- </div> -->
</md-content>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = "40">
{{msg.message}}
</div>
</div>
</md-card>
</md-tab>
<md-tab label="Tasks">
<md-content class="md-padding">
@ -176,40 +184,9 @@
</md-card>
</md-content>
</md-tab>
<!-- <md-tab label="two">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
Two
</md-content>
</md-tab> -->
</md-tabs>
</div>
</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>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</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 flex = "30">
<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-select>
</div>
</div>
</div>
</md-content>
</div>
</div>

View file

@ -43,18 +43,22 @@
<div flex = "10" layout-padding layout-margin border = "1">
Team Members:
<ul layout-padding>
<!-- <div layout = "row"> -->
<li ng-repeat = "member in project.members">
<div>
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;"> {{member.name}}</a>
<div layout = "column" ng-repeat = "member in project.members">
<!-- <li ng-repeat = "member in project.members"> -->
<div layout = "row">
<div>
<md-button ng-click = "goToProfile(member.id)">
{{member.name}}
</md-button>
</div>
<div ng-if = "isEditPressed">
<md-button ng-click="removeUserFromProject()" ng class="md-raised md-primary" aria-label="rU">
<i class="fa fa-times"></i>
</md-button>
</div>
</div>
<div ng-if = "isEditPressed">
<md-button ng-click="removeUserFromProject()" ng class="md-raised md-primary" aria-label="rU">
<i class="fa fa-times"></i>
</md-button>
</div>
</li>
<!-- </div> -->
<!-- </li> -->
</div>
</ul>
</div>
<div flex = "40">
@ -80,10 +84,27 @@
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages">
<md-content class="md-padding">
<h1 class="md-display-2">Messages</h1>
<p>Messages...</p>
</md-content>
<!-- <md-content class="md-padding"> -->
<md-card ng-repeat = "msg in userMessages">
<div layout = "column" layout-padding>
<div flex = "30" class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<div flex = "20" layout = "row">
<div>
{{msg.user.username}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = "40">
{{msg.message}}
</div>
</div>
</md-card>
<!-- </md-content> -->
</md-tab>
<md-tab label="Commits">
<md-content class="tabDesign">