This commit is contained in:
@@ -166,6 +166,22 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Plain-link confirmation prompt. HTMX has hx-confirm for its own
|
||||
// requests; this is the equivalent for raw `<a href>` anchors that
|
||||
// can't go through HTMX (e.g. "Connect (web client)", which opens
|
||||
// a new tab and triggers a popup on the controlled machine — easy
|
||||
// to fire by accident from the row action menu). Use:
|
||||
//
|
||||
// <a href="..." data-confirm="..." onclick="return confirmFromDataAttr(this)">
|
||||
//
|
||||
// The message lives in the data-attribute (only HTML-escaped, no
|
||||
// JS-string escaping) which keeps the server-side renderer simple.
|
||||
function confirmFromDataAttr(el) {
|
||||
const msg = el && el.dataset ? el.dataset.confirm : '';
|
||||
return !msg || window.confirm(msg);
|
||||
}
|
||||
window.confirmFromDataAttr = confirmFromDataAttr;
|
||||
|
||||
// Close any open per-row action popover when a click happens outside it.
|
||||
// The action dropdowns are <details class="... relative"> with an
|
||||
// absolutely-positioned panel; the deploy page uses <details> too but
|
||||
|
||||
Reference in New Issue
Block a user