admin: Show diff on settings form

This commit is contained in:
nemunaire 2022-05-26 12:53:47 +02:00
parent eb07eadae0
commit 465a48c1c0
2 changed files with 59 additions and 58 deletions

View file

@ -512,8 +512,10 @@ angular.module("FICApp")
.controller("SettingsController", function($scope, $rootScope, Settings, SettingsChallenge, $location, $http, $interval) {
$scope.displayDangerousActions = false;
$scope.config = Settings.get();
$scope.config = Settings.get();
$scope.dist_config = {};
$scope.config.$promise.then(function(response) {
$scope.dist_config = Object.assign({}, response);
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
$rootScope.settings.start = new Date(response.start);
$rootScope.settings.end = new Date(response.end);
@ -551,6 +553,7 @@ angular.module("FICApp")
var state = this.config.enableExerciceDepend;
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
this.config.$update(function(response) {
$scope.dist_config = Object.assign({}, response);
$scope.addToast('success', msg);
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
$rootScope.settings.start = new Date(nStart);