only add button per name once

This commit is contained in:
Matthias 2021-09-13 23:18:44 +02:00
parent 95924852a4
commit c890a4a6d0
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -793,14 +793,25 @@ function attachSecondaries(modal, secondaries) {
function insertActionButton(modal, options) {
/* Insert a custom submission button */
var element = $(modal).find('#modal-footer-buttons');
// check if button already present
var already_present = false;
for(var child=element[0].firstElementChild; child; child=child.nextElementSibling){
if (item.firstElementChild.name == options.name) {
already_present = true;
}
}
if (already_present == false) {
var html = `
<span style='float: right;'>
<button name='${options.name}' type='submit' class='btn btn-default modal-form-button' value='${options.name}'>
${options.title}
</button>
</span>`;
$(modal).find('#modal-footer-buttons').append(html);
element.append(html);
}
}
function attachButtons(modal, buttons) {