From 6d9c582e13864baa8a1540be8f2785b012b8ce79 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 12 Jun 2021 11:58:06 -0400 Subject: [PATCH] Merge an old stash allowing passing an alternate buttonconfig parameter to show/get Modal --- web/skins/classic/js/skin.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index 3268ccf05..c7e2afedf 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -781,7 +781,7 @@ function logAjaxFail(jqxhr, textStatus, error) { } // Load the Modal HTML via Ajax call -function getModal(id, parameters) { +function getModal(id, parameters, buttonconfig=null) { $j.getJSON(thisUrl + '?request=modal&modal='+id+'&'+parameters) .done(function(data) { if ( !data ) { @@ -790,7 +790,7 @@ function getModal(id, parameters) { } insertModalHtml(id, data.html); - manageModalBtns(id); + buttonconfig ? buttonconfig() : manageModalBtns(id); modal = $j('#'+id+'Modal'); if ( ! modal.length ) { console.log('No modal found'); @@ -800,6 +800,14 @@ function getModal(id, parameters) { .fail(logAjaxFail); } +function showModal(id, buttonconfig=null) { + var div = $j('#'+id+'Modal'); + if ( ! div.length ) { + getModal(id, buttonconfig); + } + div.modal('show'); +} + function manageModalBtns(id) { // Manage the CANCEL modal button, note data-dismiss="modal" would work better var cancelBtn = document.getElementById(id+"CancelBtn");