Rename Exercice's Keys as Flags
This commit is contained in:
parent
f36e1c4e4d
commit
d21f3b0b83
18 changed files with 252 additions and 252 deletions
|
|
@ -218,12 +218,12 @@ angular.module("FICApp")
|
|||
update: {method: 'PUT'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceKey", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/keys/:keyId", { exerciceId: '@idExercice', keyId: '@id' }, {
|
||||
.factory("ExerciceFlag", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/flags/:flagId", { exerciceId: '@idExercice', flagId: '@id' }, {
|
||||
update: {method: 'PUT'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceMCQKey", function($resource) {
|
||||
.factory("ExerciceMCQFlag", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/quiz/:mcqId", { exerciceId: '@idExercice', mcqId: '@id' }, {
|
||||
update: {method: 'PUT'}
|
||||
})
|
||||
|
|
@ -995,8 +995,8 @@ angular.module("FICApp")
|
|||
work.push("/api/sync/exercices/" + ex.id + "/files");
|
||||
if ($scope.syncHints)
|
||||
work.push("/api/sync/exercices/" + ex.id + "/hints");
|
||||
if ($scope.syncKeys)
|
||||
work.push("/api/sync/exercices/" + ex.id + "/keys");
|
||||
if ($scope.syncFlags)
|
||||
work.push("/api/sync/exercices/" + ex.id + "/flags");
|
||||
});
|
||||
$scope.total = work.length;
|
||||
go();
|
||||
|
|
@ -1004,7 +1004,7 @@ angular.module("FICApp")
|
|||
};
|
||||
$scope.syncFiles = true;
|
||||
$scope.syncHints = true;
|
||||
$scope.syncKeys = true;
|
||||
$scope.syncFlags = true;
|
||||
})
|
||||
.controller("ExercicesListController", function($scope, ThemedExercice, $routeParams, $location) {
|
||||
$scope.exercices = ThemedExercice.query({ themeId: $routeParams.themeId });
|
||||
|
|
@ -1106,35 +1106,35 @@ angular.module("FICApp")
|
|||
};
|
||||
})
|
||||
|
||||
.controller("ExerciceKeysController", function($scope, ExerciceKey, $routeParams, $rootScope, $http) {
|
||||
$scope.keys = ExerciceKey.query({ exerciceId: $routeParams.exerciceId });
|
||||
.controller("ExerciceFlagsController", function($scope, ExerciceFlag, $routeParams, $rootScope, $http) {
|
||||
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
$scope.addKey = function() {
|
||||
$scope.keys.push(new ExerciceKey());
|
||||
$scope.addFlag = function() {
|
||||
$scope.flags.push(new ExerciceFlag());
|
||||
}
|
||||
$scope.deleteKey = function() {
|
||||
this.key.$delete(function() {
|
||||
$scope.keys.splice($scope.keys.indexOf(this.key), 1);
|
||||
$scope.deleteFlag = function() {
|
||||
this.flag.$delete(function() {
|
||||
$scope.flags.splice($scope.flags.indexOf(this.flag), 1);
|
||||
}, function(response) {
|
||||
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data);
|
||||
});
|
||||
}
|
||||
$scope.saveKey = function() {
|
||||
if (this.key.id) {
|
||||
this.key.$update();
|
||||
$scope.saveFlag = function() {
|
||||
if (this.flag.id) {
|
||||
this.flag.$update();
|
||||
} else {
|
||||
this.key.$save({ exerciceId: $routeParams.exerciceId });
|
||||
this.flag.$save({ exerciceId: $routeParams.exerciceId });
|
||||
}
|
||||
}
|
||||
$scope.inSync = false;
|
||||
$scope.syncKeys = function() {
|
||||
$scope.syncFlags = function() {
|
||||
$scope.inSync = true;
|
||||
$http({
|
||||
url: "/api/sync/exercices/" + $routeParams.exerciceId + "/keys",
|
||||
url: "/api/sync/exercices/" + $routeParams.exerciceId + "/flags",
|
||||
method: "POST"
|
||||
}).then(function(response) {
|
||||
$scope.inSync = false;
|
||||
$scope.keys = ExerciceKey.query({ exerciceId: $routeParams.exerciceId });
|
||||
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||
if (response.data)
|
||||
$rootScope.newBox('danger', response.data);
|
||||
else
|
||||
|
|
@ -1146,11 +1146,11 @@ angular.module("FICApp")
|
|||
};
|
||||
})
|
||||
|
||||
.controller("ExerciceMCQKeysController", function($scope, ExerciceMCQKey, $routeParams, $rootScope, $http) {
|
||||
$scope.quiz = ExerciceMCQKey.query({ exerciceId: $routeParams.exerciceId });
|
||||
.controller("ExerciceMCQFlagsController", function($scope, ExerciceMCQFlag, $routeParams, $rootScope, $http) {
|
||||
$scope.quiz = ExerciceMCQFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
$scope.addQuiz = function() {
|
||||
$scope.quiz.push(new ExerciceMCQKey());
|
||||
$scope.quiz.push(new ExerciceMCQFlag());
|
||||
}
|
||||
$scope.deleteQuiz = function() {
|
||||
this.q.$delete(function() {
|
||||
|
|
|
|||
Reference in a new issue