admin: Fix move between exercices
This commit is contained in:
parent
a585a6338e
commit
6bd23ee9f0
4 changed files with 16 additions and 18 deletions
|
@ -1696,20 +1696,18 @@ angular.module("FICApp")
|
||||||
} else {
|
} else {
|
||||||
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
|
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.my_ex_num = {};
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
url: "api/themes.json",
|
url: "api/themes.json",
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.themes = response.data
|
$scope.themes = response.data
|
||||||
var last_exercice = null;
|
for (var k in $scope.themes[$scope.exercice.id_theme].exercices) {
|
||||||
angular.forEach($scope.themes[$scope.exercice.id_theme].exercices, function(exercice, k) {
|
var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k];
|
||||||
if (last_exercice != null) {
|
$scope.my_ex_num[exercice.id] = k;
|
||||||
$scope.themes[$scope.exercice.id_theme].exercices[last_exercice].next = k;
|
}
|
||||||
exercice.previous = last_exercice;
|
|
||||||
}
|
|
||||||
last_exercice = k;
|
|
||||||
exercice.id = k;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$scope.exercices = Exercice.query();
|
$scope.exercices = Exercice.query();
|
||||||
$scope.fields = ["title", "urlid", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "resolution", "issue", "issuekind", "wip"];
|
$scope.fields = ["title", "urlid", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "resolution", "issue", "issuekind", "wip"];
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
<button type="button" ng-click="syncFlags()" class="btn btn-light float-right"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
|
<button type="button" ng-click="syncFlags()" class="btn btn-light float-right"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
|
||||||
<h2>
|
<h2>
|
||||||
<a href="exercices/{{exercice.id}}">{{exercice.title}}</a> <small class="text-muted">Flags</small>
|
<a href="exercices/{{exercice.id}}">{{exercice.title}}</a> <small class="text-muted">Flags</small>
|
||||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices[exercice.id]">
|
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices">
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].previous }}/flags" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].previous}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1].id }}/flags" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].next }}/flags" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].next}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2].id }}/flags" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<h2>
|
<h2>
|
||||||
<a href="exercices/{{exercice.id}}">{{exercice.title}}</a> <small class="text-muted">Résolution</small>
|
<a href="exercices/{{exercice.id}}">{{exercice.title}}</a> <small class="text-muted">Résolution</small>
|
||||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices[exercice.id]">
|
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices">
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].previous }}/resolution" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].previous}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1].id }}/resolution" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].next }}/resolution" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].next}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2].id }}/resolution" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
{{exercice.title}}
|
{{exercice.title}}
|
||||||
<small ng-if="themes && themes[exercice.id_theme]"><a href="themes/{{ exercice.id_theme }}" title="{{themes[exercice.id_theme].authors | stripHTML}}">{{themes[exercice.id_theme].name}}</a></small>
|
<small ng-if="themes && themes[exercice.id_theme]"><a href="themes/{{ exercice.id_theme }}" title="{{themes[exercice.id_theme].authors | stripHTML}}">{{themes[exercice.id_theme].name}}</a></small>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices[exercice.id]">
|
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices">
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].previous }}" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].previous}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1].id }}" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
||||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].next }}" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].next}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2].id }}" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto d-flex flex-row-reverse text-nowrap">
|
<div class="ml-auto d-flex flex-row-reverse text-nowrap">
|
||||||
<a href="exercices/{{exercice.id}}/resolution" ng-disabled="!exercice.videoURI" class="ml-2 btn btn-sm btn-info"><span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> Vidéo</a>
|
<a href="exercices/{{exercice.id}}/resolution" ng-disabled="!exercice.videoURI" class="ml-2 btn btn-sm btn-info"><span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> Vidéo</a>
|
||||||
|
|
Reference in a new issue