remove old custom modal code
This commit is contained in:
parent
65f12d9efa
commit
16e468f2f3
@ -168,71 +168,6 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
// region OK modal
|
||||
|
||||
function validateBootstrapStyle(style) {
|
||||
if (!["danger", "success", "warning", "info", "primary", "secondary"].includes(style)) {
|
||||
throw new Error(`${style} is not a valid style`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function okModal(title, bodyText, style, iconClass, func) {
|
||||
let $modal = $("#okModal");
|
||||
|
||||
validateBootstrapStyle(style);
|
||||
$modal.find(".modal-dismiss-btn").addClass(`btn-${style}`);
|
||||
$modal.find(".modal-dismiss-btn > i").addClass(iconClass);
|
||||
|
||||
$modal.find(".modal-title").text(title);
|
||||
$modal.find(".modal-body > p").html(bodyText);
|
||||
|
||||
$modal.find(".modal-dismiss-btn").off("click").on("click", async function(e) {
|
||||
if (func) await func();
|
||||
$modal.modal("hide");
|
||||
});
|
||||
|
||||
$modal.modal("show");
|
||||
}
|
||||
|
||||
|
||||
// region Confirm Modal
|
||||
|
||||
async function confirmationModal(title, bodyText, style, iconClass, acceptFunc, declineFunc) {
|
||||
let $modal = $("#confirmModal");
|
||||
|
||||
validateBootstrapStyle(style);
|
||||
$modal.find(".modal-confirm-btn").addClass(`btn-${style}`);
|
||||
$modal.find(".modal-confirm-btn > i").addClass(iconClass);
|
||||
|
||||
$modal.find(".modal-title").text(title);
|
||||
$modal.find(".modal-body > p").html(bodyText);
|
||||
|
||||
$modal.find(".modal-confirm-btn").off("click").on("click", async function(e) {
|
||||
await acceptFunc()
|
||||
$modal.modal("hide");
|
||||
});
|
||||
|
||||
$modal.find(".modal-dismiss-btn").off("click").on("click", async function(e) {
|
||||
if (declineFunc) await declineFunc();
|
||||
$modal.modal("hide");
|
||||
});
|
||||
|
||||
$modal.modal("show");
|
||||
}
|
||||
|
||||
function arrayToHtmlList(array, bold=false) {
|
||||
$ul = $("<ul>").addClass("mb-0");
|
||||
|
||||
array.forEach(item => {
|
||||
let $li = $("<li>");
|
||||
$ul.append(bold ? $li.append($("<b>").text(item)) : $li.text(item));
|
||||
});
|
||||
|
||||
return $ul;
|
||||
}
|
||||
|
||||
|
||||
// region Log Error
|
||||
|
||||
function logError(error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user