frontend: keep answers on screen after submission (lost on refresh)

This commit is contained in:
nemunaire 2018-12-02 01:24:38 +01:00
commit 7b0e8195ff
2 changed files with 18 additions and 16 deletions

View file

@ -86,6 +86,7 @@
<form ng-submit="ssubmit()">
<div class="form-group" ng-repeat="(kid,key) in my.exercices[current_exercice].flags">
<label for="sol_{{ kid }}">{{ key.label }}&nbsp;:</label>
<span ng-if="key.found && key.value" ng-bind="key.value"></span>
<input type="text" class="form-control" id="sol_{{ kid }}" autocomplete="off" name="sol_{{ kid }}" ng-model="key.value" ng-if="!key.found && !key.choices">
<select class="custom-select" id="sol_{{ kid }}" name="sol_{{ kid }}" ng-model="key.value" ng-if="!key.found && key.choices" ng-options="l as v for (l, v) in key.choices"></select>
<small class="form-text text-muted" ng-if="!key.found && key.help.length > 0" ng-bind="key.help"></small>
@ -94,10 +95,11 @@
<div class="form-check" ng-repeat="(k,mcq) in my.exercices[current_exercice].mcqs">
<p ng-if="mcq.title">{{ mcq.title }} <span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="mcq.solved" title="QCM réussi à {{ mcq.solved | date:'mediumTime'}}"></span></p>
<div class="custom-control custom-checkbox" ng-repeat="(cid,choice) in mcq.choices" ng-if="!mcq.solved">
<div class="custom-control custom-checkbox" ng-repeat="(cid,choice) in mcq.choices" ng-if="!mcq.solved || mcq.justify">
<input class="custom-control-input" type="checkbox" id="mcq_{{k}}_{{cid}}" name="mcq_{{k}}_{{cid}}" ng-model="choice.value" ng-disabled="choice.disabled">
<label class="custom-control-label" for="mcq_{{k}}_{{cid}}" ng-bind="choice.label"></label>
<input type="text" class="form-control" autocomplete="off" placeholder="Flag correspondant" name="sol_{{ cid }}" ng-model="choice.justify" ng-if="choice.value && mcq.justify && !choice.solved">
<span ng-if="choice.value && mcq.justify && choice.solved" ng-bind="choice.justify"></span>
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="choice.solved" title="Flag trouvé !"></span>
</div>
<hr>