- new simpler modal without bootstrap - new loadingbutton component - cleanupsome old code - toolbar adjusments
22 lines
546 B
JavaScript
22 lines
546 B
JavaScript
// assets/controllers/loading_button_controller.js
|
|
import {Controller} from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["text", "loader"];
|
|
static values = {form: String};
|
|
|
|
startLoading(event) {
|
|
event.preventDefault();
|
|
this.textTarget.classList.add("hidden");
|
|
this.loaderTarget.classList.remove("hidden");
|
|
this.element.disabled = true;
|
|
|
|
if (this.hasFormValue) {
|
|
const form = document.getElementById(this.formValue);
|
|
if (form) {
|
|
form.submit();
|
|
}
|
|
}
|
|
}
|
|
}
|