mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Replace toggle_button_disable ctrller with generic toggle_control ctrller
- add enableIfPresent method in toggle_control_controller.js to handle enabling on toggle - add testing in the corresponding spec - replace in view previous ctrler with intended generic toggle-control
This commit is contained in:
@@ -17,6 +17,14 @@ export default class extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
enableIfPresent(event) {
|
||||
const input = event.currentTarget;
|
||||
const enable = !!this.#inputValue(input);
|
||||
|
||||
this.controlTargets.forEach((target) => {
|
||||
target.disabled = !enable;
|
||||
});
|
||||
}
|
||||
//todo: can a new method disableIfBlank replace ButtonDisabledController?
|
||||
//todo: can a new method toggleDisplay replace ToggleController?
|
||||
//todo: can toggleDisplay with optional chevron-target replace RemoteToggleController?
|
||||
|
||||
Reference in New Issue
Block a user