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() {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
<label class="btn btn-sm btn-secondary" ng-class="{active: syncHints, 'btn-warning': syncHints}" ng-show="whoami">
|
||||
<input type="checkbox" ng-model="syncHints"> Indices
|
||||
</label>
|
||||
<label class="btn btn-sm btn-secondary" ng-class="{active: syncKeys, 'btn-warning': syncKeys}">
|
||||
<input type="checkbox" ng-model="syncKeys"> Flags
|
||||
<label class="btn btn-sm btn-secondary" ng-class="{active: syncFlags, 'btn-warning': syncFlags}">
|
||||
<input type="checkbox" ng-model="syncFlags"> Flags
|
||||
</label>
|
||||
</div>
|
||||
</small>
|
||||
|
|
|
|||
|
|
@ -80,38 +80,38 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" ng-controller="ExerciceKeysController">
|
||||
<div class="col-md-4" ng-controller="ExerciceFlagsController">
|
||||
<div class="card border-success">
|
||||
<div class="card-header bg-success text-light">
|
||||
<button ng-click="addKey()" class="float-right btn btn-sm btn-primary ml-2"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
<button ng-click="syncKeys()" class="float-right btn btn-sm btn-light ml-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
|
||||
<button ng-click="addFlag()" class="float-right btn btn-sm btn-primary ml-2"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
<button ng-click="syncFlags()" class="float-right btn btn-sm btn-light ml-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
|
||||
<h4>Drapeaux</h4>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<form ng-submit="saveKey()" class="list-group-item form-horizontal bg-light text-dark" ng-repeat="key in keys">
|
||||
<div class="form-group row" id="key-{{key.id}}">
|
||||
<input type="text" id="klabel{{key.id}}" ng-model="key.label" class="col form-control" placeholder="Intitulé">
|
||||
<div class="col-auto" ng-show="key.id">
|
||||
<button ng-click="deleteKey()" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
|
||||
<form ng-submit="saveFlag()" class="list-group-item form-horizontal bg-light text-dark" ng-repeat="flag in flags">
|
||||
<div class="form-group row" id="flag-{{flag.id}}">
|
||||
<input type="text" id="klabel{{flag.id}}" ng-model="flag.label" class="col form-control" placeholder="Intitulé">
|
||||
<div class="col-auto" ng-show="flag.id">
|
||||
<button ng-click="deleteFlag()" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<input type="text" id="khelp{{key.id}}" ng-model="key.help" class="col form-control" placeholder="Indication de formatage">
|
||||
<input type="text" id="khelp{{flag.id}}" ng-model="flag.help" class="col form-control" placeholder="Indication de formatage">
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" ng-show="key.id">
|
||||
<input type="text" id="kvalue{{key.id}}" ng-model="key.value" class="col form-control" placeholder="Condensat">
|
||||
<div class="form-group row" ng-show="flag.id">
|
||||
<input type="text" id="kvalue{{flag.id}}" ng-model="flag.value" class="col form-control" placeholder="Condensat">
|
||||
</div>
|
||||
<div class="form-group row" ng-show="!key.id">
|
||||
<input type="text" id="kvalue{{key.id}}" ng-model="key.key" class="col form-control" placeholder="Chaîne à valider">
|
||||
<div class="form-group row" ng-show="!flag.id">
|
||||
<input type="text" id="kvalue{{flag.id}}" ng-model="flag.flag" class="col form-control" placeholder="Chaîne à valider">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-success mt-2" ng-controller="ExerciceMCQKeysController">
|
||||
<div class="card border-success mt-2" ng-controller="ExerciceMCQFlagsController">
|
||||
<div class="card-header bg-success text-light">
|
||||
<button ng-click="addQuiz()" class="float-right btn btn-sm btn-primary ml-2"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
<h4>Quizz</h4>
|
||||
|
|
|
|||
Reference in a new issue