admin: Add exercice's tags: sync, api, interface done
This commit is contained in:
parent
665fd301c6
commit
f183985982
10 changed files with 166 additions and 20 deletions
|
@ -208,6 +208,11 @@ angular.module("FICApp")
|
|||
update: {method: 'PUT'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceTags", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/tags", { exerciceId: '@idExercice'}, {
|
||||
update: {method: 'PUT'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceFile", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/files/:fileId", { exerciceId: '@idExercice', fileId: '@id' }, {
|
||||
update: {method: 'PUT'}
|
||||
|
@ -1023,6 +1028,11 @@ angular.module("FICApp")
|
|||
$scope.exercices = Exercice.query();
|
||||
$scope.fields = ["title", "urlid", "statement", "overview", "depend", "gain", "coefficient", "videoURI"];
|
||||
|
||||
$scope.showTags = false;
|
||||
$scope.toggleTags = function(val) {
|
||||
$scope.showTags = val ||!$scope.showTags;
|
||||
}
|
||||
|
||||
$scope.showDownloads = false;
|
||||
$scope.toggleDownloads = function(val) {
|
||||
$scope.showDownloads = val ||!$scope.showDownloads;
|
||||
|
@ -1054,6 +1064,22 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceTagsController", function($scope, ExerciceTags, $routeParams, $rootScope, $http) {
|
||||
$scope.tags = ExerciceTags.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
$scope.addTag = function() {
|
||||
$scope.toggleTags(true);
|
||||
$scope.tags.push("");
|
||||
}
|
||||
$scope.deleteTag = function() {
|
||||
$scope.tags.splice($scope.tags.indexOf(this.tag), 1);
|
||||
return $scope.saveTags();
|
||||
}
|
||||
$scope.saveTags = function() {
|
||||
ExerciceTags.update({ exerciceId: $routeParams.exerciceId }, this.tags);
|
||||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceFilesController", function($scope, ExerciceFile, $routeParams, $rootScope, $http) {
|
||||
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
|
|
Reference in a new issue