Commit 4645df03 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #7684. Optional hide second button (cancel) in link/question alerts.

parent d278b744
Pipeline #1373 failed with stage
in 2 minutes and 15 seconds
......@@ -5616,7 +5616,7 @@ Question
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Positive button text | Default: 'Ok' |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Negative button text | Default: 'Cancel' |
| Negative button text | Default: 'Cancel'. To hide the second button: '-' |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
| Timeout in seconds | 0: no timeout, >0: after the specified time in seconds, the alert will dissapear and behaves like 'negative answer' |
+----------------------+--------------------------------------------------------------------------------------------------------------------------+
......
......@@ -1094,14 +1094,16 @@ class Link {
$level = ($arr[QUESTION_INDEX_LEVEL] === '') ? DEFAULT_QUESTION_LEVEL : $arr[QUESTION_INDEX_LEVEL];
$ok = ($arr[QUESTION_INDEX_BUTTON_OK] === '') ? 'Ok' : $arr[QUESTION_INDEX_BUTTON_OK];
$cancel = ($arr[QUESTION_INDEX_BUTTON_FALSE] === '') ? 'Cancel' : $arr[QUESTION_INDEX_BUTTON_FALSE];
$cancel = ($cancel=='-') ? '': ", { label: '$cancel',eventName: 'cancel'}";
$timeout = ($arr[QUESTION_INDEX_TIMEOUT] === '') ? '0' : $arr[QUESTION_INDEX_TIMEOUT] * 1000;
$flagModalStatus = ($arr[QUESTION_INDEX_FLAG_MODAL] === '') ? '1' : $arr[QUESTION_INDEX_FLAG_MODAL];
$flagModal = ($flagModalStatus === "1") ? 'true' : 'false';
$js = <<<EOF
var alert = new QfqNS.Alert({ message: '$text', type: '$level', modal: $flagModal, timeout: $timeout, buttons: [
{ label: '$ok', eventName: 'ok' },
{ label: '$cancel',eventName: 'cancel'}
{ label: '$ok', eventName: 'ok' }
$cancel
] } );
alert.on('alert.ok', function() {
window.location = $('#$id').attr('href');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment