admin: alert can contains yes/no buttons
This commit is contained in:
parent
c906a9df01
commit
e2370c9511
3 changed files with 48 additions and 3 deletions
|
@ -266,7 +266,10 @@ angular.module("FICApp")
|
|||
var b = $rootScope._newBoxes.shift();
|
||||
$scope.boxes.unshift(b);
|
||||
var id = $scope.boxes.length - 1;
|
||||
$timeout(function() { $scope.boxes.pop(id); }, b.timeout);
|
||||
b.cancel = function() {
|
||||
$scope.boxes.pop($scope.boxes.indexOf(b));
|
||||
}
|
||||
$timeout(function() { b.cancel(); }, b.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,12 +279,45 @@ angular.module("FICApp")
|
|||
if (msg === undefined) { msg = ''; }
|
||||
if (tmout === undefined) { tmout = 5000; }
|
||||
|
||||
$rootScope._newBoxes.push({
|
||||
var mybox = {
|
||||
'kind': kind,
|
||||
'title': title,
|
||||
'msg': msg,
|
||||
'timeout': tmout,
|
||||
})
|
||||
};
|
||||
|
||||
$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();
|
||||
|
||||
|
@ -311,6 +347,11 @@ angular.module("FICApp")
|
|||
this.config.start = d.toISOString();
|
||||
var f = new Date(ts + 120000 + this.duration * 60000);
|
||||
this.config.end = f.toISOString();
|
||||
|
||||
$rootScope.newYesNoBox('info', 'Challenge ready to start,', 'propagate the changes?',
|
||||
function() {
|
||||
$scope.saveSettings();
|
||||
});
|
||||
}
|
||||
$scope.reset = function(type) {
|
||||
if (confirm("Êtes-vous sûr ?")) {
|
||||
|
|
Reference in a new issue