- in progress

This commit is contained in:
Matan Bar Yosef 2015-08-03 01:01:25 +03:00
parent 35ecdd1f60
commit afb9c38184
3 changed files with 49 additions and 32 deletions

View file

@ -118,6 +118,7 @@ angular.module('SeHub')
apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
{ {
$scope.userTasks = data; $scope.userTasks = data;
console.log($scope.userTasks);
}).error(function(err) }).error(function(err)
{ {
console.log(err.message); console.log(err.message);

View file

@ -7,21 +7,27 @@ angular.module('SeHub')
$scope.isEditPressed = false; $scope.isEditPressed = false;
$scope.user = $scope.$parent.user; $scope.user = $scope.$parent.user;
$scope.loadingData = true; $scope.loadingData = true;
$scope.displayingMessages = true;
$scope.isMaster = false; $scope.isMaster = false;
$scope.isMember = false; $scope.isMember = false;
$scope.project = []; $scope.project = [];
$scope.isInProject = false; $scope.isInProject = false;
$scope.projectMessages = []; $scope.projectMessages = [];
$scope.msg = {}; $scope.msg = {};
$scope.isMaster = false;
// $scope.thisProject = {}; // $scope.thisProject = {};
// $scope.thisProject.courseName = $routeParams.className; // $scope.thisProject.courseName = $routeParams.className;
console.log($scope.user.id)
// console.log($scope.projectid)
$scope.displayProjectMessages = function() $scope.displayProjectMessages = function()
{ {
apiService.getAllUserMessages(token).success(function(data) apiService.getAllUserMessages(token).success(function(data)
{ {
$scope.displayingMessages = false;
$scope.projectMessages = data; $scope.projectMessages = data;
}).error(function(err) }).error(function(err)
{ {
@ -31,11 +37,11 @@ angular.module('SeHub')
$scope.goToProfile = function(memberId) $scope.goToProfile = function(memberId)
{ {
$location.path('#/profile/' + memberId); $location.path('/profile/' + memberId);
} }
$scope.removeUserFromProject = function() $scope.removeUserFromProject = function()
{ {
apiService.removeUserFromProject.success(function(data) apiService.removeUserFromProject(token, $scope.user.id, projectId).success(function(data)
{ {
}).error(function(err) }).error(function(err)
@ -66,6 +72,9 @@ angular.module('SeHub')
$scope.removeProject = function(ev) $scope.removeProject = function(ev)
{ {
if($scope.user.id === $scope.project.master_id)
$scope.isMaster = true;
var confirm = $mdDialog.confirm().title('Remove Project').content('Would you like to delete this project?').ariaLabel('removeProj') var confirm = $mdDialog.confirm().title('Remove Project').content('Would you like to delete this project?').ariaLabel('removeProj')
.ok('Please do it!').cancel('No').targetEvent(ev); .ok('Please do it!').cancel('No').targetEvent(ev);
$mdDialog.show(confirm).then(function() $mdDialog.show(confirm).then(function()
@ -141,6 +150,8 @@ angular.module('SeHub')
apiService.getProjectsById(token, projectId).success(function(data) apiService.getProjectsById(token, projectId).success(function(data)
{ {
$scope.project = data; $scope.project = data;
if($scope.user.id === $scope.project.master_id)
$scope.isMaster = true;
for(var i = 0; i < data.members.length; i++) for(var i = 0; i < data.members.length; i++)
{ {
if($scope.user.id === data.members[i].id) if($scope.user.id === data.members[i].id)

View file

@ -44,20 +44,20 @@
Team Members: Team Members:
<ul layout-padding> <ul layout-padding>
<div layout = "column" ng-repeat = "member in project.members"> <div layout = "column" ng-repeat = "member in project.members">
<!-- <li ng-repeat = "member in project.members"> -->
<div layout = "row"> <div layout = "row">
<div> <div>
<md-button ng-click = "goToProfile(member.id)"> <md-button ng-click = "goToProfile(member.id)">
{{member.name}} {{member.name}}
</md-button> </md-button>
</div> </div>
<div ng-if="isMaster">
<div ng-if = "isEditPressed"> <div ng-if = "isEditPressed">
<md-button ng-click="removeUserFromProject()" ng class="md-raised md-primary" aria-label="rU"> <md-button ng-click="removeUserFromProject()" ng class="md-raised md-primary" aria-label="rU">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</md-button> </md-button>
</div> </div>
</div> </div>
<!-- </li> --> </div>
</div> </div>
</ul> </ul>
</div> </div>
@ -100,15 +100,19 @@
<div flex = "96" style="height:70%;"> <div flex = "96" style="height:70%;">
<div flex> <div flex>
<md-card> <md-card>
<md-content class="md-padding"> <md-content>
<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-card ng-repeat = "msg in userMessages"> <div ng-if="displayingMessages" layout-paddig layout-margin class="loader">
<div layout = "column" layout-padding> <md-progress-circular md-mode="indeterminate"></md-progress-circular>
<div flex = "30" class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div> </div>
<div flex = "20" layout = "row"> <md-content class="tabDesign">
<md-card ng-repeat = "msg in projectMessages">
<div layout = "row" layout-padding ng-if="!displayingMessages">
<div flex = "10">
<img ng-src="{{msg.user.avatar_url}}" style="width:80%">
</div>
<div flex = "20" layout = "column">
<div> <div>
{{msg.user.username}} {{msg.user.username}}
</div> </div>
@ -122,6 +126,7 @@
</div> </div>
</div> </div>
</md-card> </md-card>
</md-content>
</md-tab> </md-tab>
<md-tab label="Commits"> <md-tab label="Commits">
<md-content class="tabDesign"> <md-content class="tabDesign">
@ -191,12 +196,12 @@
</table> </table>
</md-content> </md-content>
</md-tab> </md-tab>
<md-tab label="tasks"> <!-- <md-tab label="tasks">
<md-content class="md-padding"> <md-content class="md-padding">
<h1 class="md-display-2">tasks</h1> <h1 class="md-display-2">tasks</h1>
<p>tasks..</p> <p>tasks..</p>
</md-content> </md-content>
</md-tab> </md-tab> -->
</md-tabs> </md-tabs>
</md-content> </md-content>
</md-card> </md-card>