Remove unneeded stuff
This commit is contained in:
@@ -3,9 +3,6 @@ import { Controller } from "@hotwired/stimulus"
|
|||||||
// Generic modal controller for showing/hiding modal dialogs
|
// Generic modal controller for showing/hiding modal dialogs
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
static targets = ["dialog"]
|
static targets = ["dialog"]
|
||||||
static values = {
|
|
||||||
refreshOnClose: { type: Boolean, default: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
show(event) {
|
show(event) {
|
||||||
// If called from a button with data-modal-id, find and show that modal
|
// If called from a button with data-modal-id, find and show that modal
|
||||||
@@ -14,8 +11,6 @@ export default class extends Controller {
|
|||||||
const modal = document.getElementById(modalId);
|
const modal = document.getElementById(modalId);
|
||||||
if (modal) {
|
if (modal) {
|
||||||
modal.classList.remove("hidden");
|
modal.classList.remove("hidden");
|
||||||
// Store the refresh preference from the button
|
|
||||||
this.refreshOnCloseValue = event.currentTarget?.dataset?.refreshOnClose === "true";
|
|
||||||
}
|
}
|
||||||
} else if (this.hasDialogTarget) {
|
} else if (this.hasDialogTarget) {
|
||||||
// Otherwise show the dialog target
|
// Otherwise show the dialog target
|
||||||
@@ -36,11 +31,6 @@ export default class extends Controller {
|
|||||||
} else {
|
} else {
|
||||||
this.element.classList.add("hidden");
|
this.element.classList.add("hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh page if requested
|
|
||||||
if (this.refreshOnCloseValue) {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close modal when clicking backdrop
|
// Close modal when clicking backdrop
|
||||||
|
|||||||
Reference in New Issue
Block a user