From 99ef5046db78baaa0f6475e2554554dbf9bedee5 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 9 Dec 2018 19:06:29 +0100 Subject: [PATCH] admin: add button to move to previous and next exercice --- admin/static/js/app.js | 15 +++++++++++++++ admin/static/views/exercice.html | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/admin/static/js/app.js b/admin/static/js/app.js index b77219a8..8335a1c9 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -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"]; diff --git a/admin/static/views/exercice.html b/admin/static/views/exercice.html index 53c132c2..69b6841c 100644 --- a/admin/static/views/exercice.html +++ b/admin/static/views/exercice.html @@ -1,5 +1,10 @@

{{exercice.title}} + {{themes[exercice.id_theme].name}} +
+ + +