frontend: treat MCQ justification as key flag, instead of special case
This commit is contained in:
parent
2879b697c0
commit
b6769086c2
4 changed files with 126 additions and 99 deletions
|
|
@ -90,26 +90,7 @@
|
|||
</ul>
|
||||
<div class="card-body" ng-if="!my.exercices[current_exercice].submitted || sberr">
|
||||
<form ng-submit="ssubmit()">
|
||||
<div class="form-group" ng-repeat="(kid,key) in my.exercices[current_exercice].flags">
|
||||
<label for="sol_{{ kid }}_0">{{ key.label }} :</label>
|
||||
<span ng-if="key.found && key.value" ng-bind="key.value"></span>
|
||||
<div class="input-group" ng-repeat="v in key.values track by $index" ng-class="{'mt-1': !$first}" ng-if="!key.found">
|
||||
<input type="text" class="form-control flag" id="sol_{{ kid }}_{{ $index }}" autocomplete="off" name="sol_{{ kid }}_{{ $index }}" ng-model="key.values[$index]" ng-if="!key.choices" placeholder="{{ key.help }}" title="{{ key.help }}">
|
||||
<select class="custom-select" id="sol_{{ kid }}" name="sol_{{ kid }}" ng-model="key.values[$index]" ng-if="key.choices" ng-options="l as v for (l, v) in key.choices"></select>
|
||||
<div class="input-group-append" ng-if="key.choices_cost">
|
||||
<button class="btn btn-success" type="button" ng-click="wantchoices(kid)" ng-class="{disabled: key.wcsubmitted}" title="Cliquez pour échanger ce champ de texte par une liste de choix. L'opération vous coûtera {{ key.choices_cost * settings.wchoiceCurrentCoefficient }} points.">
|
||||
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span>
|
||||
Liste de propositions (<ng-pluralize count="key.choices_cost * settings.wchoiceCurrentCoefficient" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize>)
|
||||
</button>
|
||||
</div>
|
||||
<div class="input-group-append" ng-if="key.separator && $last">
|
||||
<button class="btn btn-success" type="button" ng-click="additem(key)" title="Ajouter un élément.">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="key.found" title="Flag trouvé à {{ key.found | date:'mediumTime'}}"></span>
|
||||
</div>
|
||||
<flag-key ng-repeat="(kid,key) in my.exercices[current_exercice].flags" kid="kid" key="key" settings="settings" wantchoices="wantchoices"></flag-key>
|
||||
|
||||
<div class="form-group" 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>
|
||||
|
|
@ -117,7 +98,7 @@
|
|||
<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="{{ choice.help }}" name="sol_{{ cid }}" ng-model="choice.justify" ng-if="choice.value && mcq.justify && !choice.solved">
|
||||
<flag-key kid="cid" key="choice.justification" settings="settings" wantchoices="wantchoices" ng-if="choice.value && mcq.justify && (!choice.justification || !choice.justification.solved)"></flag-key>
|
||||
<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>
|
||||
|
|
|
|||
Reference in a new issue