admin: replace notifications with bootstrap toast
This commit is contained in:
parent
3bc8d7064b
commit
45069d4fbb
@ -111,20 +111,12 @@ const indextpl = `<!DOCTYPE html>
|
|||||||
<div class="progress-bar bg-secondary" role="progressbar" style="width: {{ "{{timeProgression * 100}}" }}%"></div>
|
<div class="progress-bar bg-secondary" role="progressbar" style="width: {{ "{{timeProgression * 100}}" }}%"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container" ng-controller="DIWEBoxController" style="position:fixed;z-index:10;width:50vw;left:25vw;bottom:0;" ng-cloak>
|
|
||||||
<div ng-repeat="box in boxes" class="alert alert-dismissible alert-{{"{{ box.kind }}"}}" ng-cloak>
|
|
||||||
<button type="button" class="close" aria-label="Close" ng-click="box.cancel()"><span aria-hidden="true">×</span></button>
|
|
||||||
<strong ng-if="box.title" ng-bind="box.title"></strong> <span ng-bind-html="box.msg"></span>
|
|
||||||
<ul ng-if="box.list">
|
|
||||||
<li ng-repeat="i in box.list" ng-bind="i"></li>
|
|
||||||
</ul>
|
|
||||||
<button type="button" class="ml-2 btn btn-sm btn-success" ng-if="box.yes || box.no" ng-click="box.yes()">Yes</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-danger" ng-if="box.yes || box.no" ng-click="box.no()">No</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container mt-1" ng-view></div>
|
<div class="container mt-1" ng-view></div>
|
||||||
|
|
||||||
|
<div style="position: fixed; top: 60px; right: 0; z-index: 10; min-width: 30vw;">
|
||||||
|
<toast ng-repeat="toast in toasts" yes-no="toast.yesFunc || toast.noFunc" onyes="toast.yesFunc" onno="toast.noFunc" date="toast.date" msg="toast.msg" timeout="toast.timeout" title="toast.title" variant="toast.variant"></toast>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="/js/jquery.min.js"></script>
|
<script src="/js/jquery.min.js"></script>
|
||||||
<script src="js/popper.min.js"></script>
|
<script src="js/popper.min.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
|
@ -109,20 +109,12 @@
|
|||||||
<div class="progress-bar bg-secondary" role="progressbar" style="width: {{timeProgression * 100}}%"></div>
|
<div class="progress-bar bg-secondary" role="progressbar" style="width: {{timeProgression * 100}}%"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container" ng-controller="DIWEBoxController" style="position:fixed;z-index:10;width:50vw;left:25vw;bottom:0;" ng-cloak>
|
|
||||||
<div ng-repeat="box in boxes" class="alert alert-dismissible alert-{{ box.kind }}" ng-cloak>
|
|
||||||
<button type="button" class="close" aria-label="Close" ng-click="box.cancel()"><span aria-hidden="true">×</span></button>
|
|
||||||
<strong ng-if="box.title" ng-bind="box.title"></strong> <span ng-bind-html="box.msg"></span>
|
|
||||||
<ul ng-if="box.list">
|
|
||||||
<li ng-repeat="i in box.list" ng-bind="i"></li>
|
|
||||||
</ul>
|
|
||||||
<button type="button" class="ml-2 btn btn-sm btn-success" ng-if="box.yes || box.no" ng-click="box.yes()">Yes</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-danger" ng-if="box.yes || box.no" ng-click="box.no()">No</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container mt-1" ng-view></div>
|
<div class="container mt-1" ng-view></div>
|
||||||
|
|
||||||
|
<div style="position: fixed; top: 60px; right: 0; z-index: 10; min-width: 30vw;">
|
||||||
|
<toast ng-repeat="toast in toasts" yes-no="toast.yesFunc || toast.noFunc" onyes="toast.yesFunc" onno="toast.noFunc" date="toast.date" msg="toast.msg" timeout="toast.timeout" title="toast.title" variant="toast.variant"></toast>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="/js/jquery.min.js"></script>
|
<script src="/js/jquery.min.js"></script>
|
||||||
<script src="js/popper.min.js"></script>
|
<script src="js/popper.min.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
|
@ -127,7 +127,54 @@ angular.module("FICApp")
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]);
|
}])
|
||||||
|
|
||||||
|
.component('toast', {
|
||||||
|
bindings: {
|
||||||
|
date: '=',
|
||||||
|
msg: '=',
|
||||||
|
timeout: '=',
|
||||||
|
title: '=',
|
||||||
|
variant: '=',
|
||||||
|
yesNo: '=',
|
||||||
|
onyes: '=',
|
||||||
|
onno: '=',
|
||||||
|
},
|
||||||
|
controller: function($element) {
|
||||||
|
if (this.timeout === 0)
|
||||||
|
$element.children(0).toast({autohide: false});
|
||||||
|
else if (!this.timeout && this.timeout !== 0)
|
||||||
|
$element.children(0).toast({delay: 7000});
|
||||||
|
else
|
||||||
|
$element.children(0).toast({delay: this.timeout});
|
||||||
|
$element.children(0).toast('show');
|
||||||
|
this.yesFunc = function() {
|
||||||
|
$element.children(0).toast('dispose');
|
||||||
|
if (this.onyes)
|
||||||
|
this.onyes();
|
||||||
|
}
|
||||||
|
this.noFunc = function() {
|
||||||
|
$element.children(0).toast('dispose');
|
||||||
|
if (this.onno)
|
||||||
|
this.onno();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<div class="toast mb-2" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="toast-header">
|
||||||
|
<span ng-if="$ctrl.variant" class="badge badge-pill badge-{{ $ctrl.variant }}" style="padding: .25em .66em"> </span>
|
||||||
|
<strong class="mr-auto" ng-bind="$ctrl.title"></strong>
|
||||||
|
<small class="text-muted" ng-bind="$ctrl.date">just now</small>
|
||||||
|
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" ng-bind-html="$ctrl.msg" ng-if="$ctrl.msg"></div>
|
||||||
|
<div class="d-flex justify-content-around mb-1" ng-if="$ctrl.yesNo">
|
||||||
|
<button type="button" class="ml-2 btn btn-sm btn-success" ng-click="$ctrl.yesFunc()">Yes</button>
|
||||||
|
<button type="button" class="btn btn-sm btn-danger" ng-click="$ctrl.noFunc()">No</button>
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
});
|
||||||
|
|
||||||
angular.module("FICApp")
|
angular.module("FICApp")
|
||||||
.factory("Version", function($resource) {
|
.factory("Version", function($resource) {
|
||||||
@ -395,15 +442,27 @@ angular.module("FICApp")
|
|||||||
refresh();
|
refresh();
|
||||||
$interval(refresh, 10000);
|
$interval(refresh, 10000);
|
||||||
|
|
||||||
|
$rootScope.toasts = [];
|
||||||
|
$rootScope.addToast = function(kind, title, msg, yesFunc, noFunc, tmout) {
|
||||||
|
$rootScope.toasts.unshift({
|
||||||
|
variant: kind,
|
||||||
|
title: title,
|
||||||
|
msg: msg,
|
||||||
|
timeout: tmout,
|
||||||
|
yesFunc: yesFunc,
|
||||||
|
noFunc: noFunc,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$rootScope.staticFilesNeedUpdate = 0;
|
$rootScope.staticFilesNeedUpdate = 0;
|
||||||
$rootScope.regenerateStaticFiles = function() {
|
$rootScope.regenerateStaticFiles = function() {
|
||||||
Settings.get().$promise.then(function(config) {
|
Settings.get().$promise.then(function(config) {
|
||||||
config.generation = (new Date()).toISOString();
|
config.generation = (new Date()).toISOString();
|
||||||
config.$update(function() {
|
config.$update(function() {
|
||||||
$rootScope.staticFilesNeedUpdate = 0;
|
$rootScope.staticFilesNeedUpdate = 0;
|
||||||
$rootScope.newBox('success', "Regeneration in progress...");
|
$scope.addToast('success', "Regeneration in progress...");
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
$rootScope.newBox('success', 'An error occurs when saving settings:', response.data.errmsg);
|
$scope.addToast('success', 'An error occurs when saving settings:', response.data.errmsg);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -435,76 +494,6 @@ angular.module("FICApp")
|
|||||||
$scope.monitor = Monitor.get();
|
$scope.monitor = Monitor.get();
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller("DIWEBoxController", function($scope, $rootScope, $interval, $timeout) {
|
|
||||||
function updBox() {
|
|
||||||
while ($rootScope._newBoxes.length > 0) {
|
|
||||||
var b = $rootScope._newBoxes.shift();
|
|
||||||
$scope.boxes.unshift(b);
|
|
||||||
var id = $scope.boxes.length - 1;
|
|
||||||
b.cancel = function() {
|
|
||||||
$scope.boxes.pop($scope.boxes.indexOf(b));
|
|
||||||
}
|
|
||||||
if (b.timeout >= 0)
|
|
||||||
$timeout(function() { b.cancel(); }, b.timeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$rootScope._newBoxes = new Array();
|
|
||||||
$rootScope.newBox = function(kind, title, msg, tmout) {
|
|
||||||
if (kind === undefined) { kind = 'default'; }
|
|
||||||
if (msg === undefined) { msg = ''; }
|
|
||||||
if (tmout === undefined) { tmout = 5000; }
|
|
||||||
|
|
||||||
var mybox = {
|
|
||||||
'kind': kind,
|
|
||||||
'title': title,
|
|
||||||
'timeout': tmout,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Array.isArray(msg))
|
|
||||||
mybox['list'] = msg;
|
|
||||||
else
|
|
||||||
mybox['msg'] = msg;
|
|
||||||
|
|
||||||
$rootScope._newBoxes.push(mybox);
|
|
||||||
};
|
|
||||||
$rootScope.newYesNoBox = function(kind, title, msg, yesFunc, noFunc, tmout) {
|
|
||||||
if (kind === undefined) { kind = 'default'; }
|
|
||||||
if (msg === undefined) { msg = ''; }
|
|
||||||
if (tmout === undefined) { tmout = 5000; }
|
|
||||||
|
|
||||||
var mybox;
|
|
||||||
|
|
||||||
var yesFn = function() {
|
|
||||||
mybox.cancel();
|
|
||||||
if (yesFunc !== undefined) {
|
|
||||||
yesFunc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var noFn = function() {
|
|
||||||
mybox.cancel();
|
|
||||||
if (noFunc !== undefined) {
|
|
||||||
noFunc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mybox = {
|
|
||||||
'kind': kind,
|
|
||||||
'title': title,
|
|
||||||
'msg': msg,
|
|
||||||
'yes': yesFn,
|
|
||||||
'no': noFn,
|
|
||||||
'timeout': tmout,
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope._newBoxes.push(mybox);
|
|
||||||
};
|
|
||||||
$scope.boxes = new Array();
|
|
||||||
|
|
||||||
updBox();
|
|
||||||
$interval(updBox, 750);
|
|
||||||
})
|
|
||||||
|
|
||||||
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http, $interval) {
|
.controller("SettingsController", function($scope, $rootScope, Settings, ROSettings, $location, $http, $interval) {
|
||||||
$scope.displayDangerousActions = false;
|
$scope.displayDangerousActions = false;
|
||||||
$scope.config = Settings.get();
|
$scope.config = Settings.get();
|
||||||
@ -555,14 +544,14 @@ angular.module("FICApp")
|
|||||||
var state = this.config.enableExerciceDepend;
|
var state = this.config.enableExerciceDepend;
|
||||||
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
|
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
|
||||||
this.config.$update(function(response) {
|
this.config.$update(function(response) {
|
||||||
$rootScope.newBox('success', msg);
|
$scope.addToast('success', msg);
|
||||||
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
|
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
|
||||||
$rootScope.settings.start = new Date(nStart);
|
$rootScope.settings.start = new Date(nStart);
|
||||||
$rootScope.settings.end = new Date(nEnd);
|
$rootScope.settings.end = new Date(nEnd);
|
||||||
$rootScope.settings.generation = new Date(nGen);
|
$rootScope.settings.generation = new Date(nGen);
|
||||||
$rootScope.settings.activateTime = new Date(aTime);
|
$rootScope.settings.activateTime = new Date(aTime);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when saving settings:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when saving settings:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.regenerate = function() {
|
$scope.regenerate = function() {
|
||||||
@ -577,7 +566,7 @@ angular.module("FICApp")
|
|||||||
var f = new Date(ts + 120000 + this.duration * 60000);
|
var f = new Date(ts + 120000 + this.duration * 60000);
|
||||||
this.config.end = f.toISOString();
|
this.config.end = f.toISOString();
|
||||||
|
|
||||||
$rootScope.newYesNoBox('info', 'Challenge ready to start,', 'propagate the changes?',
|
$scope.addToast('info', 'Challenge ready to start,', 'propagate the changes?',
|
||||||
function() {
|
function() {
|
||||||
$scope.saveSettings();
|
$scope.saveSettings();
|
||||||
});
|
});
|
||||||
@ -593,14 +582,14 @@ angular.module("FICApp")
|
|||||||
"teams": "En validant, vous supprimerez l'ensemble des équipes enregistreées.",
|
"teams": "En validant, vous supprimerez l'ensemble des équipes enregistreées.",
|
||||||
"game": "En validant, vous supprimerez toutes les tentatives, les validations, ... faites par les équipes.",
|
"game": "En validant, vous supprimerez toutes les tentatives, les validations, ... faites par les équipes.",
|
||||||
}
|
}
|
||||||
$rootScope.newYesNoBox('warning', txts[type], 'Êtes-vous sûr de vouloir continuer ?',
|
$scope.addToast('warning', txts[type], 'Êtes-vous sûr de vouloir continuer ?',
|
||||||
function() {
|
function() {
|
||||||
if (confirm("Êtes-vous vraiment sûr ?\n" + txts[type])) {
|
if (confirm("Êtes-vous vraiment sûr ?\n" + txts[type])) {
|
||||||
$http.post("/api/reset", {"type": type}).then(function(time) {
|
$http.post("/api/reset", {"type": type}).then(function(time) {
|
||||||
$rootScope.newBox('success', type + 'reseted');
|
$scope.addToast('success', type + 'reseted');
|
||||||
$location.url("/");
|
$location.url("/");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when reseting ' + type + ':', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when reseting ' + type + ':', response.data.errmsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -615,28 +604,28 @@ angular.module("FICApp")
|
|||||||
question = 'Faire une synchronisation intégrale ?'
|
question = 'Faire une synchronisation intégrale ?'
|
||||||
url = "/api/sync/deep"
|
url = "/api/sync/deep"
|
||||||
}
|
}
|
||||||
$rootScope.newYesNoBox('warning', question, '',
|
$scope.addToast('warning', question, '',
|
||||||
function() {
|
function() {
|
||||||
$scope.deepSyncInProgress = true;
|
$scope.deepSyncInProgress = true;
|
||||||
$http.post(url).then(function() {
|
$http.post(url).then(function() {
|
||||||
$scope.deepSyncInProgress = false;
|
$scope.deepSyncInProgress = false;
|
||||||
$rootScope.newBox('success', 'Synchronisation intégrale terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
$scope.addToast('success', 'Synchronisation intégrale terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.deepSyncInProgress = false;
|
$scope.deepSyncInProgress = false;
|
||||||
$rootScope.newBox('warning', 'Synchronisation intégrale terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
$scope.addToast('warning', 'Synchronisation intégrale terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.speedyDeepSync = function() {
|
$scope.speedyDeepSync = function() {
|
||||||
$rootScope.newYesNoBox('warning', 'Faire une synchronisation profonde rapide, sans s\'occuper des fichiers ?', '',
|
$scope.addToast('warning', 'Faire une synchronisation profonde rapide, sans s\'occuper des fichiers ?', '',
|
||||||
function() {
|
function() {
|
||||||
$scope.deepSyncInProgress = true;
|
$scope.deepSyncInProgress = true;
|
||||||
$http.post("/api/sync/speed").then(function() {
|
$http.post("/api/sync/speed").then(function() {
|
||||||
$scope.deepSyncInProgress = false;
|
$scope.deepSyncInProgress = false;
|
||||||
$rootScope.newBox('success', 'Synchronisation profonde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
$scope.addToast('success', 'Synchronisation profonde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.deepSyncInProgress = false;
|
$scope.deepSyncInProgress = false;
|
||||||
$rootScope.newBox('warning', 'Synchronisation profinde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
$scope.addToast('warning', 'Synchronisation profinde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -667,7 +656,7 @@ angular.module("FICApp")
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -703,7 +692,7 @@ angular.module("FICApp")
|
|||||||
$scope.certificates = Certificate.query();
|
$scope.certificates = Certificate.query();
|
||||||
$scope.selectedTeam = null;
|
$scope.selectedTeam = null;
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -712,7 +701,7 @@ angular.module("FICApp")
|
|||||||
$http.post("/api/ca/new", $scope.newca).then(function() {
|
$http.post("/api/ca/new", $scope.newca).then(function() {
|
||||||
$scope.ca = CACertificate.get();
|
$scope.ca = CACertificate.get();
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when generating CA:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when generating CA:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.renewCA = function() {
|
$scope.renewCA = function() {
|
||||||
@ -723,21 +712,21 @@ angular.module("FICApp")
|
|||||||
$http.post("/api/certs").then(function() {
|
$http.post("/api/certs").then(function() {
|
||||||
$scope.certificates = Certificate.query();
|
$scope.certificates = Certificate.query();
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when generating certificate:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when generating certificate:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.generateHtpasswd = function() {
|
$scope.generateHtpasswd = function() {
|
||||||
$http.post("/api/htpasswd").then(function() {
|
$http.post("/api/htpasswd").then(function() {
|
||||||
$rootScope.newBox('success', 'Fichier htpasswd généré avec succès');
|
$scope.addToast('success', 'Fichier htpasswd généré avec succès');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when generating htpasswd file:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when generating htpasswd file:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.removeHtpasswd = function() {
|
$scope.removeHtpasswd = function() {
|
||||||
$http.delete("/api/htpasswd").then(function() {
|
$http.delete("/api/htpasswd").then(function() {
|
||||||
$rootScope.newBox('success', 'Fichier htpasswd supprimé avec succès');
|
$scope.addToast('success', 'Fichier htpasswd supprimé avec succès');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when deleting htpasswd file:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when deleting htpasswd file:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1006,9 +995,9 @@ angular.module("FICApp")
|
|||||||
$scope.someUpdt = false;
|
$scope.someUpdt = false;
|
||||||
var prms = Scene.update({ screenId: $scope.screenid }, $scope.display);
|
var prms = Scene.update({ screenId: $scope.screenid }, $scope.display);
|
||||||
prms.$promise.then(function() {
|
prms.$promise.then(function() {
|
||||||
$rootScope.newBox('success', 'Scene successfully published!');
|
$scope.addToast('success', 'Scene successfully published!');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when saving scene:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when saving scene:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.addSide = function() {
|
$scope.addSide = function() {
|
||||||
@ -1361,7 +1350,7 @@ angular.module("FICApp")
|
|||||||
$scope.comm.ndescription = "Création de la tâche";
|
$scope.comm.ndescription = "Création de la tâche";
|
||||||
$scope.saveDescription();
|
$scope.saveDescription();
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to save claim:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to save claim:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1404,12 +1393,12 @@ angular.module("FICApp")
|
|||||||
$scope.themes = Theme.query();
|
$scope.themes = Theme.query();
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', response.data);
|
$scope.addToast('danger', response.data);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', 'Synchronisation de la liste des thèmes terminée avec succès.');
|
$scope.addToast('success', 'Synchronisation de la liste des thèmes terminée avec succès.');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchronizing theme list:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchronizing theme list:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1432,7 +1421,7 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$location.url("/themes/");
|
$location.url("/themes/");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to delete theme:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to delete theme:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1479,7 +1468,7 @@ angular.module("FICApp")
|
|||||||
})
|
})
|
||||||
$scope.exercice = {};
|
$scope.exercice = {};
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$rootScope.newBox('success', 'Édition de masse terminée avec succès');
|
$scope.addToast('success', 'Édition de masse terminée avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.show = function(id) {
|
$scope.show = function(id) {
|
||||||
@ -1493,7 +1482,7 @@ angular.module("FICApp")
|
|||||||
var work = [];
|
var work = [];
|
||||||
var go = function() {
|
var go = function() {
|
||||||
if (!work.length) {
|
if (!work.length) {
|
||||||
$rootScope.newBox('info', "Synchronisation des exercices terminée.");
|
$scope.addToast('info', "Synchronisation des exercices terminée.");
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1547,12 +1536,12 @@ angular.module("FICApp")
|
|||||||
$scope.exercices = ThemedExercice.query({ themeId: $scope.theme.id });
|
$scope.exercices = ThemedExercice.query({ themeId: $scope.theme.id });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('warning', null, response.data, -1);
|
$scope.addToast('warning', null, response.data, -1);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', 'Synchronisation de la liste des exercices terminée avec succès.');
|
$scope.addToast('success', 'Synchronisation de la liste des exercices terminée avec succès.');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchrinizing exercices:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchrinizing exercices:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1591,12 +1580,12 @@ angular.module("FICApp")
|
|||||||
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
|
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', response.data);
|
$scope.addToast('danger', response.data);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', "Synchronisation de l'exercice terminée avec succès.");
|
$scope.addToast('success', "Synchronisation de l'exercice terminée avec succès.");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchronizing exercice:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchronizing exercice:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1606,7 +1595,7 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$location.url("/themes/" + tid);
|
$location.url("/themes/" + tid);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to delete exercice:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to delete exercice:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.saveExercice = function() {
|
$scope.saveExercice = function() {
|
||||||
@ -1618,7 +1607,7 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$location.url("/themes/" + $scope.exercice.idTheme + "/exercices/" + $scope.exercice.id);
|
$location.url("/themes/" + $scope.exercice.idTheme + "/exercices/" + $scope.exercice.id);
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to save exercice:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to save exercice:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1684,7 +1673,7 @@ angular.module("FICApp")
|
|||||||
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$('#updHistory').modal('hide');
|
$('#updHistory').modal('hide');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when updating history item: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when updating history item: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1697,7 +1686,7 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
$scope.history = ExerciceHistory.query({ exerciceId: $routeParams.exerciceId });
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when removing history item: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1719,7 +1708,7 @@ angular.module("FICApp")
|
|||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when removing file dep:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when removing file dep:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
return false;
|
return false;
|
||||||
@ -1739,12 +1728,12 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', response.data);
|
$scope.addToast('danger', response.data);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', "Synchronisation de la liste de fichiers terminée avec succès.");
|
$scope.addToast('success', "Synchronisation de la liste de fichiers terminée avec succès.");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchronizing flags list:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchronizing flags list:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1760,7 +1749,7 @@ angular.module("FICApp")
|
|||||||
$scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId });
|
$scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to delete hint:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to delete hint:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.saveHint = function() {
|
$scope.saveHint = function() {
|
||||||
@ -1782,12 +1771,12 @@ angular.module("FICApp")
|
|||||||
$scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId });
|
$scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', response.data);
|
$scope.addToast('danger', response.data);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', "Synchronisation de la liste d'indices terminée avec succès.");
|
$scope.addToast('success', "Synchronisation de la liste d'indices terminée avec succès.");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchronizing hints list:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchronizing hints list:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1819,7 +1808,7 @@ angular.module("FICApp")
|
|||||||
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.saveFlag = function() {
|
$scope.saveFlag = function() {
|
||||||
@ -1845,10 +1834,10 @@ angular.module("FICApp")
|
|||||||
method: "POST"
|
method: "POST"
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
flag.test_str = "";
|
flag.test_str = "";
|
||||||
$rootScope.newBox('success', "Flag Ok !");
|
$scope.addToast('success', "Flag Ok !");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
flag.test_str = "";
|
flag.test_str = "";
|
||||||
$rootScope.newBox('danger', 'An error occurs: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1863,12 +1852,12 @@ angular.module("FICApp")
|
|||||||
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', response.data);
|
$scope.addToast('danger', response.data);
|
||||||
else
|
else
|
||||||
$rootScope.newBox('success', "Synchronisation de la liste de drapeaux terminée avec succès.");
|
$scope.addToast('success', "Synchronisation de la liste de drapeaux terminée avec succès.");
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$scope.inSync = false;
|
$scope.inSync = false;
|
||||||
$rootScope.newBox('danger', 'An error occurs when synchronizing flags list:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when synchronizing flags list:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@ -1925,7 +1914,7 @@ angular.module("FICApp")
|
|||||||
$scope.quiz = ExerciceMCQFlag.query({ exerciceId: $routeParams.exerciceId });
|
$scope.quiz = ExerciceMCQFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.saveQuiz = function() {
|
$scope.saveQuiz = function() {
|
||||||
@ -1975,7 +1964,7 @@ angular.module("FICApp")
|
|||||||
$http.post("/api/disableinactiveteams").then(function() {
|
$http.post("/api/disableinactiveteams").then(function() {
|
||||||
$scope.teams = Team.query();
|
$scope.teams = Team.query();
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when disabling inactive teams:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when disabling inactive teams:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.show = function(id) {
|
$scope.show = function(id) {
|
||||||
@ -2022,8 +2011,8 @@ angular.module("FICApp")
|
|||||||
}
|
}
|
||||||
$scope.deleteTeam = function() {
|
$scope.deleteTeam = function() {
|
||||||
backName = this.team.name;
|
backName = this.team.name;
|
||||||
this.team.$remove(function() { $rootScope.newBox('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); $rootScope.staticFilesNeedUpdate++; },
|
this.team.$remove(function() { $scope.addToast('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); $rootScope.staticFilesNeedUpdate++; },
|
||||||
function(response) { $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data.errmsg); });
|
function(response) { $scope.addToast('danger', 'An error occurs during suppression of the team:', response.data.errmsg); });
|
||||||
}
|
}
|
||||||
$scope.showStats = function() {
|
$scope.showStats = function() {
|
||||||
$location.url("/teams/" + $scope.team.id + "/stats");
|
$location.url("/teams/" + $scope.team.id + "/stats");
|
||||||
@ -2053,9 +2042,9 @@ angular.module("FICApp")
|
|||||||
certificate.serial = parseInt(certificate.id).toString(16);
|
certificate.serial = parseInt(certificate.id).toString(16);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$rootScope.newBox('success', 'Certificate successfully dissociated!');
|
$scope.addToast('success', 'Certificate successfully dissociated!');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when dissociating certiticate:', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when dissociating certiticate:', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -2071,7 +2060,7 @@ angular.module("FICApp")
|
|||||||
$scope.associations = TeamAssociation.query({ teamId: $routeParams.teamId });
|
$scope.associations = TeamAssociation.query({ teamId: $routeParams.teamId });
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
if (response.data)
|
if (response.data)
|
||||||
$rootScope.newBox('danger', 'An error occurs when creating user association: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when creating user association: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2081,7 +2070,7 @@ angular.module("FICApp")
|
|||||||
function() {
|
function() {
|
||||||
$scope.associations = TeamAssociation.query({ teamId: $routeParams.teamId });
|
$scope.associations = TeamAssociation.query({ teamId: $routeParams.teamId });
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when removing user association: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when removing user association: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -2105,7 +2094,7 @@ angular.module("FICApp")
|
|||||||
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
|
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
|
||||||
$('#updHistory').modal('hide');
|
$('#updHistory').modal('hide');
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when updating history item: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when updating history item: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2118,7 +2107,7 @@ angular.module("FICApp")
|
|||||||
$rootScope.staticFilesNeedUpdate++;
|
$rootScope.staticFilesNeedUpdate++;
|
||||||
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
|
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data.errmsg);
|
$scope.addToast('danger', 'An error occurs when removing history item: ', response.data.errmsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user