Inherit all stimulus controllers from base_controller

This commit is contained in:
Eugene Burmakin
2025-02-15 16:48:03 +01:00
parent 7dfec304e4
commit aaa3c77162
16 changed files with 71 additions and 30 deletions
@@ -0,0 +1,23 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = {
selfHosted: Boolean
}
// Every controller that extends BaseController and uses initialize()
// should call super.initialize()
// Example:
// export default class extends BaseController {
// initialize() {
// super.initialize()
// }
// }
initialize() {
// Get the self-hosted value from the HTML root element
if (!this.hasSelfHostedValue) {
const selfHosted = document.documentElement.dataset.selfHosted === 'true'
this.selfHostedValue = selfHosted
}
}
}