Tasks...
This commit is contained in:
parent
6437396125
commit
35ecdd1f60
4 changed files with 109 additions and 11 deletions
|
@ -7,18 +7,32 @@ angular.module('SeHub')
|
||||||
$scope.user = $scope.$parent.user;
|
$scope.user = $scope.$parent.user;
|
||||||
apiService.getAllUserTasks(token).success(function(data) {
|
apiService.getAllUserTasks(token).success(function(data) {
|
||||||
$scope.tasks = data;
|
$scope.tasks = data;
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
}).error(function(err) {
|
}).error(function(err) {
|
||||||
console.log(err.message);
|
console.error(err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.taskClicked = function(task, classId, isPersonal) {
|
$scope.taskClicked = function(task, classId, isPersonal, masterId, ev) {
|
||||||
var ownerId = null;
|
var ownerId = null;
|
||||||
if (classId === $scope.user.id) {
|
if (masterId === $scope.user.id) {
|
||||||
///This Is The Lecturer
|
///This Is The Lecturer
|
||||||
///Need to show the List
|
///Need to show the List
|
||||||
|
$mdDialog.show({
|
||||||
|
controller: DialogController,
|
||||||
|
templateUrl: 'templates/views/UserStateList.html?v=1',
|
||||||
|
parent: $scope,
|
||||||
|
targetEvent: ev,
|
||||||
|
locals: {
|
||||||
|
data: {task: task, token: token, isPersonal: isPersonal}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function(answer) {
|
||||||
|
$scope.alert = 'You said the information was "' + answer + '".';
|
||||||
|
}, function() {
|
||||||
|
$scope.alert = 'You cancelled the dialog.';
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!isPersonal) {
|
if (!isPersonal) {
|
||||||
apiService.getProjectsByCourse(token, task.courseId).success(function(data) {
|
apiService.getProjectsByCourse(token, task.courseId).success(function(data) {
|
||||||
|
@ -27,11 +41,11 @@ angular.module('SeHub')
|
||||||
if (data[i].id.toString() === $scope.user.projects_id_list[j])
|
if (data[i].id.toString() === $scope.user.projects_id_list[j])
|
||||||
ownerId = $scope.user.projects_id_list[j];
|
ownerId = $scope.user.projects_id_list[j];
|
||||||
}
|
}
|
||||||
apiService.isTaskSubmitted(token, task.id, ownerId).success(function(data){
|
apiService.isTaskSubmitted(token, task.id, ownerId).success(function(data) {
|
||||||
if(data.submitted)
|
if (data.submitted)
|
||||||
$location.path('/tasks/overview/'+task.id+'/'+ownerId+'/'+ownerId)
|
$location.path('/tasks/overview/' + task.id + '/' + ownerId + '/' + ownerId)
|
||||||
else
|
else
|
||||||
$location.path('/tasks/fill/'+task.id+'/'+ownerId)
|
$location.path('/tasks/fill/' + task.id + '/' + ownerId)
|
||||||
})
|
})
|
||||||
}).error(function(err) {
|
}).error(function(err) {
|
||||||
console.error('Error: ', err);
|
console.error('Error: ', err);
|
||||||
|
@ -41,5 +55,35 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function DialogController($scope, $mdDialog, data, apiService) {
|
||||||
|
|
||||||
|
console.log(apiService);
|
||||||
|
$scope.task = data.task;
|
||||||
|
$scope.isPersonal = data.isPersonal;
|
||||||
|
var token = data.token;
|
||||||
|
$scope.loading = true;
|
||||||
|
|
||||||
|
apiService.getUsersStateByTask(token, $scope.task.id).success(function(data){
|
||||||
|
$scope.classList = data;
|
||||||
|
$scope.loading = false;
|
||||||
|
}).error(function(err){
|
||||||
|
console.error(err);
|
||||||
|
$scope.hide();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$scope.hide = function() {
|
||||||
|
$mdDialog.hide();
|
||||||
|
};
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$mdDialog.cancel();
|
||||||
|
};
|
||||||
|
$scope.answer = function(answer) {
|
||||||
|
$mdDialog.hide(answer);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
|
@ -287,6 +287,14 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
url: url
|
url: url
|
||||||
};
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
|
},
|
||||||
|
getUsersStateByTask: function(token, taskId){
|
||||||
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getUsersStateByTask/" + token + '/' + taskId;
|
||||||
|
req = {
|
||||||
|
method: 'GET',
|
||||||
|
url: url
|
||||||
|
};
|
||||||
|
return $http(req);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
46
templates/views/UserStateList.html
Normal file
46
templates/views/UserStateList.html
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<md-dialog aria-label="Class Status" style='width: 80%'>
|
||||||
|
<form>
|
||||||
|
<md-toolbar>
|
||||||
|
<div class="md-toolbar-tools">
|
||||||
|
<h2>{{task.title}} - Class Status</h2>
|
||||||
|
<span flex></span>
|
||||||
|
<md-button ng-click="answer('not applicable')">
|
||||||
|
X
|
||||||
|
</md-button>
|
||||||
|
</div>
|
||||||
|
</md-toolbar>
|
||||||
|
<md-dialog-conten layout-padding>
|
||||||
|
<div ng-if='loading'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div ng-if='!loading'>
|
||||||
|
<div ng-repeat="obj in classList">
|
||||||
|
<div layout='row' width='100%' >
|
||||||
|
<div>
|
||||||
|
<img ng-src="{{obj.avatar_url || obj.logo_url}}" alt="" class='campusAvatar' style='max-height:auto'>
|
||||||
|
</div>
|
||||||
|
<div class='spacer'></div>
|
||||||
|
<div>{{obj.name || obj.projectName}}</div>
|
||||||
|
<div class='spacer'></div>
|
||||||
|
<div>
|
||||||
|
{{obj.grade.grade || "Not Yet Reviewed"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<md-divider ng-if="!$last"></md-divider>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</md-dialog-content>
|
||||||
|
<div class="md-actions" layout="row">
|
||||||
|
<md-button href="http://en.wikipedia.org/wiki/Mango" target="_blank" hide show-md>
|
||||||
|
More on Wikipedia
|
||||||
|
</md-button>
|
||||||
|
<span flex></span>
|
||||||
|
<md-button ng-click="answer('not useful')" class="md-primary">
|
||||||
|
Not Useful
|
||||||
|
</md-button>
|
||||||
|
<md-button ng-click="answer('useful')" class="md-primary">
|
||||||
|
Useful
|
||||||
|
</md-button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</md-dialog>
|
|
@ -63,7 +63,7 @@
|
||||||
<div class="Personal" style='width:100%' >
|
<div class="Personal" style='width:100%' >
|
||||||
<div layout='column' ng-repeat="personalTask in class.PersonalTasks">
|
<div layout='column' ng-repeat="personalTask in class.PersonalTasks">
|
||||||
<div>
|
<div>
|
||||||
<md-button style='width: 100%' layout='row'>
|
<md-button style='width: 100%' layout='row' ng-click="taskClicked(personalTask, class.courseId, true, class.master_id, $event)">
|
||||||
<div>
|
<div>
|
||||||
{{personalTask.title}}
|
{{personalTask.title}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<div class="Project" style='width:100%'>
|
<div class="Project" style='width:100%'>
|
||||||
<div layout='column' ng-repeat="projectTask in class.projectTasks">
|
<div layout='column' ng-repeat="projectTask in class.projectTasks">
|
||||||
|
|
||||||
<md-button style='width: 100%' layout='row'>
|
<md-button style='width: 100%' layout='row' ng-click="taskClicked(projectTask, class.courseId, false, class.master_id, $event)">
|
||||||
<div>
|
<div>
|
||||||
{{projectTask.title}}
|
{{projectTask.title}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue