-remove project - fixed
-remove user from project - in progress
This commit is contained in:
parent
afcc8d889f
commit
6d73b98d6a
6 changed files with 62 additions and 35 deletions
|
@ -21,28 +21,23 @@ angular.module('SeHub')
|
||||||
if($scope.user.isLecturer)
|
if($scope.user.isLecturer)
|
||||||
{
|
{
|
||||||
$scope.isStudent = false;
|
$scope.isStudent = false;
|
||||||
console.log("Lecturer Mode!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$scope.isStudent = true;
|
$scope.isStudent = true;
|
||||||
console.log("Student Mode!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.displayMessages = function()
|
$scope.displayMessages = function()
|
||||||
{
|
{
|
||||||
apiService.getAllUserMessages(token).success(function(data)
|
apiService.getAllUserMessages(token).success(function(data)
|
||||||
{
|
{
|
||||||
// console.log(data);
|
|
||||||
$scope.userMessages = data;
|
$scope.userMessages = data;
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err.message);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// $scope.displayMessages(); //
|
|
||||||
|
|
||||||
$scope.addMessageClicked = function()
|
$scope.addMessageClicked = function()
|
||||||
{
|
{
|
||||||
$scope.addMsg = true; // Reveal the "POST" Button
|
$scope.addMsg = true; // Reveal the "POST" Button
|
||||||
|
@ -90,11 +85,11 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
apiService.getProjectsByCourse(token, task.courseId).success(function(data)
|
apiService.getProjectsByCourse(token, task.courseId).success(function(data)
|
||||||
{
|
{
|
||||||
console.log($scope.user);
|
// console.log($scope.user);
|
||||||
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])
|
if($scope.user.projects_id_list[i] === data[j].id.toString())
|
||||||
{
|
{
|
||||||
$location.path('/tasks/fill/' + task.id + '/' + data[j].id);
|
$location.path('/tasks/fill/' + task.id + '/' + data[j].id);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +106,6 @@ 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(data);
|
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
|
|
|
@ -5,7 +5,6 @@ angular.module('SeHub')
|
||||||
$scope.myProjectsEmpty = true;
|
$scope.myProjectsEmpty = true;
|
||||||
$scope.user = $scope.$parent.user;
|
$scope.user = $scope.$parent.user;
|
||||||
var token = $cookies['com.sehub.www'];
|
var token = $cookies['com.sehub.www'];
|
||||||
console.log(token);
|
|
||||||
|
|
||||||
$scope.displayMyProjects = function()
|
$scope.displayMyProjects = function()
|
||||||
{
|
{
|
||||||
|
@ -18,11 +17,9 @@ angular.module('SeHub')
|
||||||
$scope.myProjectsEmpty = false;
|
$scope.myProjectsEmpty = false;
|
||||||
}
|
}
|
||||||
init(); // Executing the function to initialize my projects display
|
init(); // Executing the function to initialize my projects display
|
||||||
console.log(data);
|
|
||||||
console.log("Success");
|
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err.message);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,25 @@ 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.isMasterOrLecturer = false;
|
$scope.isMaster = false;
|
||||||
$scope.isMember = false;
|
$scope.isMember = false;
|
||||||
|
|
||||||
// $scope.thisProject = {};
|
// $scope.thisProject = {};
|
||||||
// $scope.thisProject.courseName = $routeParams.className;
|
// $scope.thisProject.courseName = $routeParams.className;
|
||||||
|
|
||||||
$scope.joinProject = function()
|
$scope.removeUserFromProject = function()
|
||||||
|
{
|
||||||
|
apiService.removeUserFromProject.success(function(data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}).error(function(err)
|
||||||
|
{
|
||||||
|
console.log(err.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.joinProject = function(ev)
|
||||||
{
|
{
|
||||||
apiService.joinProject(token, projectId).success(function(data)
|
apiService.joinProject(token, projectId).success(function(data)
|
||||||
{
|
{
|
||||||
|
@ -30,25 +42,32 @@ angular.module('SeHub')
|
||||||
|
|
||||||
$scope.editProject = function(ev)
|
$scope.editProject = function(ev)
|
||||||
{
|
{
|
||||||
$scope.isEditPressed = true;
|
$scope.isEditPressed = !$scope.isEditPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.removeProject = function(ev)
|
$scope.removeProject = function(ev)
|
||||||
{
|
{
|
||||||
$mdDialog.show($mdDialog.confirm().title('Remove Project').content('Are you sure you want to remove the project ?')
|
var confirm = $mdDialog.confirm().title('Remove Project').content('Would you like to delete this project?').ariaLabel('removeProj')
|
||||||
.ariaLabel('Removing project alert dialog').ok('Yes').cancel('No').targetEvent(ev));
|
.ok('Please do it!').cancel('No').targetEvent(ev);
|
||||||
|
$mdDialog.show(confirm).then(function()
|
||||||
|
{ // Yes - Remove the project
|
||||||
|
console.log("Removed");
|
||||||
|
|
||||||
/*
|
apiService.removeProject(token, projectId).success(function(data)
|
||||||
.than(function()
|
{
|
||||||
{
|
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removed successfully.')
|
||||||
$scope.alert = 'You decided to get rid of your debt.';
|
.ariaLabel('project remove alert dialog').ok('Ok').targetEvent(ev));
|
||||||
|
}).error(function(err)
|
||||||
|
{
|
||||||
|
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason' + err.message)
|
||||||
|
.ariaLabel('project remove alert dialog').ok('Try Again').targetEvent(ev));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function()
|
function()
|
||||||
{
|
{ // No - Dont remove
|
||||||
$scope.alert = 'You decided to keep your debt.';
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,14 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
};
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
},
|
},
|
||||||
|
removeUserFromProject: function(token, userId, projectId){
|
||||||
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/removeUserFromProject/" + token + "/" + userId + "/" + projectId;
|
||||||
|
req = {
|
||||||
|
method: "DELETE",
|
||||||
|
url: url
|
||||||
|
};
|
||||||
|
return $http(req);
|
||||||
|
},
|
||||||
getAllFutureTasks: function(token){
|
getAllFutureTasks: function(token){
|
||||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token;
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token;
|
||||||
req = {
|
req = {
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
</md-card>
|
</md-card>
|
||||||
<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"><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">
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
</md-card>
|
</md-card>
|
||||||
<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"><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">
|
||||||
|
|
|
@ -19,17 +19,17 @@
|
||||||
<!-- <div ng-if = "isMasterOrLecturer"> -->
|
<!-- <div ng-if = "isMasterOrLecturer"> -->
|
||||||
<md-card layout = "row">
|
<md-card layout = "row">
|
||||||
<div ng-if="!isMember" layout-padding>
|
<div ng-if="!isMember" layout-padding>
|
||||||
<md-button ng-click="joinProject()" ng class = "md-raised md-primary">
|
<md-button ng-click="joinProject($event)" ng class = "md-raised md-primary" aria-label="jP">
|
||||||
<i class="fa fa-user-plus"></i>
|
<i class="fa fa-user-plus"></i>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
<div layout-padding>
|
<div layout-padding>
|
||||||
<md-button ng-click="editProject($event)" ng class="md-raised md-primary">
|
<md-button ng-click="editProject($event)" ng class="md-raised md-primary" aria-label="eP">
|
||||||
<i class="fa fa-pencil-square-o"></i>
|
<i class="fa fa-pencil-square-o"></i>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
<div layout-padding>
|
<div layout-padding>
|
||||||
<md-button ng-click="removeProject($event)" ng class="md-raised md-primary">
|
<md-button ng-click="removeProject($event)" ng class="md-raised md-primary" aria-label="rP">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,9 +43,18 @@
|
||||||
<div flex = "10" layout-padding layout-margin border = "1">
|
<div flex = "10" layout-padding layout-margin border = "1">
|
||||||
Team Members:
|
Team Members:
|
||||||
<ul layout-padding>
|
<ul layout-padding>
|
||||||
<li ng-repeat = "member in project.members">
|
<div layout = "row">
|
||||||
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;"> {{member.name}}</a>
|
<li ng-repeat = "member in project.members">
|
||||||
</li>
|
<div>
|
||||||
|
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;"> {{member.name}}</a>
|
||||||
|
</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>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div flex = "40">
|
<div flex = "40">
|
||||||
|
|
Loading…
Reference in a new issue