- joinProject - added
-team members - fixed
This commit is contained in:
parent
aade478e5f
commit
dbfaf90972
3 changed files with 35 additions and 0 deletions
|
@ -8,10 +8,25 @@ angular.module('SeHub')
|
|||
$scope.user = $scope.$parent.user;
|
||||
$scope.loadingData = true;
|
||||
$scope.isMasterOrLecturer = false;
|
||||
$scope.isMember = false;
|
||||
|
||||
// $scope.thisProject = {};
|
||||
// $scope.thisProject.courseName = $routeParams.className;
|
||||
|
||||
$scope.joinProject = function()
|
||||
{
|
||||
apiService.joinProject(token, projectId).success(function(data)
|
||||
{
|
||||
$scope.isMember = true;
|
||||
$scope.project = data;
|
||||
$mdDialog.show($mdDialog.alert().title('Join Project').content('Joined successfully.')
|
||||
.ariaLabel('Join project alert dialog').ok('Aight').targetEvent(ev));
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log("Error: " + err.message);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.editProject = function(ev)
|
||||
{
|
||||
$scope.isEditPressed = true;
|
||||
|
@ -46,6 +61,13 @@ angular.module('SeHub')
|
|||
apiService.getProjectsById(token, projectId).success(function(data)
|
||||
{
|
||||
$scope.project = data;
|
||||
for(var i = 0; i < data.members.length; i++)
|
||||
{
|
||||
if($scope.user.id === data.members[i].id)
|
||||
{
|
||||
$scope.isMember = true;
|
||||
}
|
||||
}
|
||||
// if($scope.user === $scope.project.info.master_id)
|
||||
// {
|
||||
// $scope.isMasterOrLecturer = true;
|
||||
|
|
|
@ -181,6 +181,14 @@ service.factory('apiService', ['$http', function($http) {
|
|||
};
|
||||
return $http(req);
|
||||
},
|
||||
joinProject: function(token, projectId){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/joinProject/" + token + "/" + projectId;
|
||||
req = {
|
||||
method: "PUT",
|
||||
url: url
|
||||
};
|
||||
return $http(req);
|
||||
},
|
||||
getCourseById: function(token, id){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesById/" + token + "/" + id;
|
||||
req = {
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
<div layout = "row" flex = "45">
|
||||
<!-- <div ng-if = "isMasterOrLecturer"> -->
|
||||
<md-card layout = "row">
|
||||
<div ng-if="isMember" layout-padding>
|
||||
<md-button ng-click="joinProject()" ng class = "md-raised md-primary">
|
||||
<i class="fa fa-user-plus"></i>
|
||||
</md-button>
|
||||
</div>
|
||||
<div layout-padding>
|
||||
<md-button ng-click="editProject($event)" ng class="md-raised md-primary">
|
||||
<i class="fa fa-pencil-square-o"></i>
|
||||
|
|
Loading…
Reference in a new issue