admin: add button to move to previous and next exercice
This commit is contained in:
parent
aa3750bb68
commit
99ef5046db
@ -1055,6 +1055,21 @@ angular.module("FICApp")
|
||||
} else {
|
||||
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
|
||||
}
|
||||
$http({
|
||||
url: "/api/themes.json",
|
||||
method: "GET"
|
||||
}).then(function(response) {
|
||||
$scope.themes = response.data
|
||||
var last_exercice = null;
|
||||
angular.forEach($scope.themes[$scope.exercice.id_theme].exercices, function(exercice, k) {
|
||||
if (last_exercice != null) {
|
||||
$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.fields = ["title", "urlid", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "issue", "issuekind"];
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
<h2>
|
||||
{{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>
|
||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices[exercice.id]">
|
||||
<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[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>
|
||||
</div>
|
||||
<button type="button" ng-click="syncExo()" ng-class="{'disabled': inSync}" class="float-right btn btn-sm btn-light"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
|
||||
</h2>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user