From 1c09ae2fa8b18acc7b0701e073239af272a85cf6 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Sun, 18 Nov 2018 21:27:35 +0100 Subject: [PATCH] admin: Continue refactoring of exercice view --- admin/static/js/app.js | 23 +++++++++++++++++ admin/static/views/exercice.html | 43 +++++++++++++------------------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 95013394..b56d5268 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -1023,6 +1023,26 @@ angular.module("FICApp") $scope.exercices = Exercice.query(); $scope.fields = ["title", "urlid", "statement", "overview", "depend", "gain", "coefficient", "videoURI"]; + $scope.showDownloads = false; + $scope.toggleDownloads = function(val) { + $scope.showDownloads = val ||!$scope.showDownloads; + } + + $scope.showHints = false; + $scope.toggleHints = function(val) { + $scope.showHints = val || !$scope.showHints; + } + + $scope.showFlags = false; + $scope.toggleFlags = function(val) { + $scope.showFlags = val || !$scope.showFlags; + } + + $scope.showQuizz = false; + $scope.toggleQuizz = function(val) { + $scope.showQuizz = val || !$scope.showQuizz; + } + $scope.saveExercice = function() { if (this.exercice.id) { this.exercice.$update(); @@ -1070,6 +1090,7 @@ angular.module("FICApp") $scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId }); $scope.addHint = function() { + $scope.toggleHints(true); $scope.hints.push(new ExerciceHint()); } $scope.deleteHint = function() { @@ -1110,6 +1131,7 @@ angular.module("FICApp") $scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId }); $scope.addFlag = function() { + $scope.toggleFlags(true); $scope.flags.push(new ExerciceFlag()); } $scope.deleteFlag = function() { @@ -1150,6 +1172,7 @@ angular.module("FICApp") $scope.quiz = ExerciceMCQFlag.query({ exerciceId: $routeParams.exerciceId }); $scope.addQuiz = function() { + $scope.toggleQuizz(true); $scope.quiz.push(new ExerciceMCQFlag()); } $scope.deleteQuiz = function() { diff --git a/admin/static/views/exercice.html b/admin/static/views/exercice.html index ee6b2b77..6dedba68 100644 --- a/admin/static/views/exercice.html +++ b/admin/static/views/exercice.html @@ -27,11 +27,13 @@
- - -

Téléchargements

+

Téléchargements

-
+
+
+ + +
@@ -46,22 +48,14 @@
-
-
- -
- -
- -
-
+
-

Indices

+

Indices

-
+
@@ -84,16 +78,14 @@
-
-
-
-
+
+
-

Drapeaux

+

Drapeaux

-
+
@@ -121,15 +113,13 @@
-
-
-
+
-

Quizz

+

Quizz

-
+
@@ -161,6 +151,7 @@
+