///
import $ from "jquery";
function ujsPrompt(el: HTMLElement) {
const link = $(el);
const href = link.attr("href"),
method = link.data("method"),
csrfToken = $("meta[name=csrf-token]").attr("content"),
csrfParam = $("meta[name=csrf-param]").attr("content"),
form = $(`
`),
msg = link.data("prompt"),
value = prompt(msg),
paramName = link.data("param-name") || "prompt-value",
promptParamInput = ``;
let metadataInput = ``
if (csrfParam !== undefined && csrfToken !== undefined) {
metadataInput += ``;
}
form.hide().append(metadataInput).append(promptParamInput).appendTo("body");
form.submit();
}
$("a[data-prompt]").on("click", function(e) {
e.stopImmediatePropagation();
e.preventDefault();
ujsPrompt(this);
});