admin: Handle challenge info on settings page
This commit is contained in:
parent
c713a0a25d
commit
48ee5321a8
2 changed files with 286 additions and 210 deletions
|
@ -223,6 +223,11 @@ angular.module("FICApp")
|
|||
'update': {method: 'PUT'},
|
||||
})
|
||||
})
|
||||
.factory("SettingsChallenge", function($resource) {
|
||||
return $resource("api/challenge.json", null, {
|
||||
'update': {method: 'PUT'},
|
||||
})
|
||||
})
|
||||
.factory("Scene", function($resource) {
|
||||
return $resource("api/public/:screenId", { screenId: '@id' }, {
|
||||
'update': {method: 'PUT'},
|
||||
|
@ -494,7 +499,7 @@ angular.module("FICApp")
|
|||
$scope.monitor = Monitor.get();
|
||||
})
|
||||
|
||||
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http, $interval) {
|
||||
.controller("SettingsController", function($scope, $rootScope, Settings, SettingsChallenge, ROSettings, $location, $http, $interval) {
|
||||
$scope.displayDangerousActions = false;
|
||||
$scope.config = Settings.get();
|
||||
$scope.config.$promise.then(function(response) {
|
||||
|
@ -505,6 +510,7 @@ angular.module("FICApp")
|
|||
$rootScope.settings.activateTime = new Date(response.activateTime);
|
||||
})
|
||||
$scope.configro = ROSettings.get();
|
||||
$scope.challenge = SettingsChallenge.get();
|
||||
$scope.duration = 360;
|
||||
|
||||
$scope.exerciceDependChange = function() {
|
||||
|
@ -542,6 +548,13 @@ angular.module("FICApp")
|
|||
}, 1500);
|
||||
$scope.$on('$destroy', function () { $interval.cancel(progressInterval); });
|
||||
|
||||
$scope.saveChallengeInfo = function() {
|
||||
this.challenge.$update(function(response) {
|
||||
$scope.addToast('success', 'Infos du challenge mises à jour avec succès !');
|
||||
}, function(response) {
|
||||
$scope.addToast('danger', 'An error occurs when saving challenge info:', response.data.errmsg);
|
||||
});
|
||||
}
|
||||
$scope.saveSettings = function(msg) {
|
||||
if (msg === undefined) { msg = 'New settings saved!'; }
|
||||
var nStart = this.config.start;
|
||||
|
|
Reference in a new issue