Merge pull request #2054 from matmair/fix-for-2004

Fix for 2004
This commit is contained in:
Oliver 2021-09-14 10:00:19 +10:00 committed by GitHub
commit 1643a2ccb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -793,14 +793,25 @@ function attachSecondaries(modal, secondaries) {
function insertActionButton(modal, options) { function insertActionButton(modal, options) {
/* Insert a custom submission button */ /* 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 = ` var html = `
<span style='float: right;'> <span style='float: right;'>
<button name='${options.name}' type='submit' class='btn btn-default modal-form-button' value='${options.name}'> <button name='${options.name}' type='submit' class='btn btn-default modal-form-button' value='${options.name}'>
${options.title} ${options.title}
</button> </button>
</span>`; </span>`;
element.append(html);
$(modal).find('#modal-footer-buttons').append(html); }
} }
function attachButtons(modal, buttons) { function attachButtons(modal, buttons) {