mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Introduce a helper for handling events (#25433)
Instead of
```hbs
{{on "input" (action this.foo value="target.value")}}
{{on "input" (action (mut this.bar) value="target.value")}}
```
you can use:
```hbs
{{on "input" (with-event-value this.foo)}}
{{on "input" (with-event-value (fn (mut this.bar)))}}
```
or in gjs:
```gjs
import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import withEventValue from "discourse/helpers/with-event-value";
…
{{on "input" (withEventValue (fn (mut this.bar)))}}
```
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
class="filter-reports-input"
|
||||
placeholder={{i18n "admin.dashboard.filter_reports"}}
|
||||
autofocus={{true}}
|
||||
{{on "input" (action "filterReports" value="target.value")}}
|
||||
{{on "input" (with-event-value this.filterReports)}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user