Commit 3799826d authored by Tino Goratsch's avatar Tino Goratsch

display the dialogs presented by bootbox in the current locale

parent 4575d585
......@@ -43,6 +43,7 @@ class MarkEntries
'confirmationTextMultiple' => $this->translator->t('system', 'confirm_delete_multiple'),
'noEntriesSelectedText' => $this->translator->t('system', 'no_entries_selected'),
],
'bootboxLocale' => $this->translator->getShortIsoCode(),
]
);
......
......@@ -97,7 +97,8 @@ jQuery.fn.deleteMarkedResults = function (options) {
confirmationTextSingle: '',
confirmationTextMultiple: '',
noEntriesSelectedText: ''
}
},
bootboxLocale: 'en'
},
$this = $(this),
settings = $.extend(defaults, options);
......@@ -108,22 +109,31 @@ jQuery.fn.deleteMarkedResults = function (options) {
const $entries = $('form .table input[name="' + settings.checkBoxName + '[]"]:checked');
if ($entries.length > 0) {
const data = {
action: 'confirmed'
};
const confirmationText = $entries.length === 1 ? settings.language.confirmationTextSingle : (settings.language.confirmationTextMultiple.replace('{items}', $entries.length));
bootbox.confirm(confirmationText, function (result) {
if (result) {
const $form = $this.closest('form');
$form.formSubmit({customFormData: data});
$form.triggerHandler('submit');
const confirmationText = $entries.length === 1
? settings.language.confirmationTextSingle
: (settings.language.confirmationTextMultiple.replace('{items}', $entries.length));
bootbox.confirm({
message: confirmationText,
locale: settings.bootboxLocale,
callback: (result) => {
if (result) {
const $form = $this.closest('form');
$form.formSubmit({
customFormData: {
action: 'confirmed'
}
});
$form.triggerHandler('submit');
}
}
});
} else {
bootbox.alert(settings.language.noEntriesSelectedText);
bootbox.alert({
message: settings.language.noEntriesSelectedText,
locale: settings.bootboxLocale
});
}
});
......
Markdown is supported
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