admin: add exercice history.json
This commit is contained in:
parent
2381fb490b
commit
60ec9704e3
4 changed files with 182 additions and 0 deletions
|
@ -228,6 +228,9 @@ angular.module("FICApp")
|
|||
update: {method: 'PUT'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceHistory", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/history.json", { exerciceId: '@id' })
|
||||
})
|
||||
.factory("ExerciceFile", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/files/:fileId", { exerciceId: '@idExercice', fileId: '@id' }, {
|
||||
update: {method: 'PUT'}
|
||||
|
@ -1272,6 +1275,22 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceHistoryController", function($scope, ExerciceHistory, $routeParams, $http, $rootScope) {
|
||||
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
||||
$scope.delHistory = function(row) {
|
||||
$http({
|
||||
url: "/api/exercices/" + $routeParams.exerciceId + "/history.json",
|
||||
method: "DELETE",
|
||||
data: row
|
||||
}).then(function(response) {
|
||||
$rootScope.staticFilesNeedUpdate++;
|
||||
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
||||
}, function(response) {
|
||||
$rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data.errmsg);
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceFilesController", function($scope, ExerciceFile, $routeParams, $rootScope, $http) {
|
||||
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
|
|
Reference in a new issue