Initial commit

This commit is contained in:
2023-07-23 13:34:00 +01:00
commit 967c16b6bf
65 changed files with 2868 additions and 0 deletions

View File

@ -0,0 +1,33 @@
import { Controller } from "/lib/hotwired/stimulus/dist/stimulus.js";
export default class ModalController extends Controller {
static targets = ["frame"];
open() {
if (!this.element.open) {
this.element.showModal();
}
}
close(event) {
if (!this.element.open) {
return;
}
event.preventDefault();
this.element.close();
this.frameTarget.src = undefined;
this.frameTarget.innerHTML = "";
switch (event.type) {
case "turbo:submit-end":
Turbo.visit(location.href, { action: "replace" });
break;
case "popstate":
event.stopImmediatePropagation();
history.go(1);
break;
}
}
}