Merge pull request #155 from sagidayan/UI

- team members in project - fixed
This commit is contained in:
Sagi Dayan 2015-08-02 23:52:58 +03:00
commit 6437396125
6 changed files with 227 additions and 143 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

@ -4,7 +4,6 @@ angular.module('SeHub')
{
$scope.isStudent = false;
$scope.addMsg = false;
$scope.msgToPost = "";
$scope.oldText = "";
$scope.messages = [];
$scope.userMessages = [];
@ -40,11 +39,10 @@ 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
{
console.log($scope.courseObj);
{
if($scope.msg.msgToAdd != null && $scope.courseObj.courseName)
{
jsonNewMsg = {
@ -68,9 +66,30 @@ 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/overview/' + task.id + '/' + data[j].id + '/' + data[j].id);
}).error(function(err)
{
console.log(err.message);
});
}
}
$scope.gotoTask = function(task)
{
console.log(task);
if(task.isPersonal)
{
$location.path('/tasks/fill/' + task.id + '/' + $scope.user.id);
@ -130,7 +149,6 @@ angular.module('SeHub')
{
console.log(err.message);
});
}
$scope.getCourses = function()

View file

@ -11,10 +11,28 @@ angular.module('SeHub')
$scope.isMember = false;
$scope.project = [];
$scope.isInProject = false;
$scope.projectMessages = [];
$scope.msg = {};
// $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)
@ -67,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++)
@ -124,5 +174,7 @@ angular.module('SeHub')
console.log(err.message);
});
}
$scope.displayProjectMessages(); // Display all messages in project
$scope.getProjectInfo(); // Get all this project data
}]);

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,65 +112,15 @@
</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>
<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>
</div>
</md-card>
</md-content>
<!-- </div> -->
</md-content>
</md-tab>
<md-tab label="Tasks">
<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>
</div>
</md-card>
<div class ="addMessage" layout="row" layout-margin layout padding>
<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>
@ -193,7 +128,6 @@
<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">
@ -210,6 +144,48 @@
</div>
</div>
</div>
<md-content>
<md-card>
<div flex="100">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Messages">
<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-tab>
<md-tab label="Tasks">
<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-tabs>
</div>
</md-card>
</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">
@ -73,6 +77,25 @@
</div>
</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>
</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 flex = "96" style="height:70%;">
<div flex>
@ -80,10 +103,25 @@
<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-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-tab>
<md-tab label="Commits">
<md-content class="tabDesign">