mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-23 07:09:39 +02:00
* Create sidebar element and working with turbo * Add overview fields * Add columns to transations and tidy modal * permit new transaction params * Add autosubmit form controller * remove unused show code
33 lines
896 B
JavaScript
33 lines
896 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
|
|
export default class extends Controller {
|
|
|
|
get cssInputSelector() {
|
|
return 'input:not(.no-auto-submit), textarea:not(.no-auto-submit)';
|
|
}
|
|
|
|
get inputElements() {
|
|
return this.element.querySelectorAll(this.cssInputSelector);
|
|
}
|
|
|
|
get selectElements() {
|
|
return this.element.querySelectorAll('select:not(.no-auto-submit)');
|
|
}
|
|
|
|
connect() {
|
|
this.inputElements.forEach(el => el.addEventListener('change', this.handler.bind(this)));
|
|
this.selectElements.forEach(el => el.addEventListener('change', this.handler.bind(this)));
|
|
}
|
|
|
|
disconnect() {
|
|
this.inputElements.forEach(el => el.removeEventListener('change', this.handler.bind(this)));
|
|
this.selectElements.forEach(el => el.removeEventListener('change', this.handler.bind(this)));
|
|
}
|
|
|
|
handler(e) {
|
|
console.log(e);
|
|
this.element.requestSubmit();
|
|
}
|
|
|
|
}
|
|
|