diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 16d5d52f..8e1d52ba 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -529,6 +529,7 @@ angular.module("FICApp") $scope.config[k] = ns.values[k]; }); $scope.config.enableExerciceDepend = $scope.config.unlockedChallengeDepth >= 0; + $scope.config.disabledsubmitbutton = $scope.config.disablesubmitbutton && $scope.config.disablesubmitbutton.length > 0; } $scope.deleteNextSettings = function(ns) { ns.$delete().then(function() { @@ -542,6 +543,7 @@ angular.module("FICApp") $scope.config.$promise.then(function(response) { $scope.dist_config = Object.assign({}, response); response.enableExerciceDepend = response.unlockedChallengeDepth >= 0; + response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0; $rootScope.settings.start = new Date(response.start); $rootScope.settings.end = new Date(response.end); $rootScope.settings.generation = new Date(response.generation); @@ -562,6 +564,13 @@ angular.module("FICApp") $scope.config.unlockedChallengeDepth = -1; }; + $scope.submitButtonStateChange = function() { + if ($scope.config.disabledsubmitbutton) + $scope.config.disablesubmitbutton = "Mise à jour en cours..."; + else + $scope.config.disablesubmitbutton = ""; + }; + $scope.saveChallengeInfo = function() { this.challenge.duration = $scope.duration; this.challenge.$update(function(response) { @@ -577,6 +586,7 @@ angular.module("FICApp") var nGen = this.config.generation; var state = this.config.enableExerciceDepend; this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1) + this.config.disablesubmitbutton = (this.config.disabledsubmitbutton?this.config.disablesubmitbutton:'') var updateQuery = {}; if (this.activateTime && this.activateTime != '0001-01-01T00:00:00Z') { updateQuery['t'] = this.activateTime; @@ -590,6 +600,7 @@ angular.module("FICApp") $scope.addToast('success', msg); $scope.nextsettings = NextSettings.query(); response.enableExerciceDepend = response.unlockedChallengeDepth >= 0; + response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0; $rootScope.settings.start = new Date(nStart); $rootScope.settings.end = new Date(nEnd); $rootScope.settings.generation = new Date(nGen); diff --git a/admin/static/views/settings.html b/admin/static/views/settings.html index 060a8ca3..17dd0b36 100644 --- a/admin/static/views/settings.html +++ b/admin/static/views/settings.html @@ -158,16 +158,16 @@
@@ -206,6 +206,14 @@ +
+ +
+ diff --git a/frontend/ui/src/components/ExerciceFlags.svelte b/frontend/ui/src/components/ExerciceFlags.svelte index c176db57..74f64cc2 100644 --- a/frontend/ui/src/components/ExerciceFlags.svelte +++ b/frontend/ui/src/components/ExerciceFlags.svelte @@ -10,11 +10,13 @@ ListGroupItem, Progress, Spinner, + Tooltip, } from 'sveltestrap'; import { blake2b } from 'hash-wasm'; import { my } from '../stores/my.js'; + import { settings } from '../stores/settings.js'; import DateFormat from './DateFormat.svelte'; import FlagKey from './FlagKey.svelte'; @@ -224,13 +226,17 @@ + {#if $settings.disablesubmitbutton} + {$settings.disablesubmitbutton} + {/if} diff --git a/frontend/ui/src/components/ExerciceHints.svelte b/frontend/ui/src/components/ExerciceHints.svelte index 70b1e0cb..212de408 100644 --- a/frontend/ui/src/components/ExerciceHints.svelte +++ b/frontend/ui/src/components/ExerciceHints.svelte @@ -117,7 +117,7 @@ {#if !(hint.content || hint.file) || (!hint.file && hint.hidden)}
{#if !(hint.content || hint.file)} -
- diff --git a/frontend/ui/src/components/TeamChangeName.svelte b/frontend/ui/src/components/TeamChangeName.svelte index 7ab8916f..2bd199f5 100644 --- a/frontend/ui/src/components/TeamChangeName.svelte +++ b/frontend/ui/src/components/TeamChangeName.svelte @@ -8,6 +8,7 @@ } from 'sveltestrap'; import { my } from '../stores/my.js'; + import { settings } from '../stores/settings.js'; export let refresh_my; @@ -101,7 +102,7 @@
- +
diff --git a/frontend/ui/src/stores/settings.js b/frontend/ui/src/stores/settings.js index e77010c2..931d44ce 100644 --- a/frontend/ui/src/stores/settings.js +++ b/frontend/ui/src/stores/settings.js @@ -18,6 +18,8 @@ function createSettingsStore() { settings.generation = new Date(settings.generation); if (settings.activateTime) settings.activateTime = new Date(settings.activateTime); + if (!settings.disablesubmitbutton) + settings.disablesubmitbutton = null; settings.recvTime = recvTime; const x_fic_time = res_settings.headers.get("x-fic-time"); diff --git a/settings/settings.go b/settings/settings.go index 37971c4e..eb2bac22 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -77,6 +77,8 @@ type Settings struct { DisplayMCQBadCount bool `json:"displayMCQBadCount,omitempty"` // EventKindness will ask browsers to delay notification interval. EventKindness bool `json:"eventKindness,omitempty"` + // DisableSubmitButton replace button by this text (eg. scheduled updates, ...). + DisableSubmitButton string `json:"disablesubmitbutton,omitempty"` } // ExistsSettings checks if the settings file can by found at the given path.