-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge listbox_controller and filter_controller into command_controller
- Loading branch information
1 parent
d3d6bfc
commit 193393a
Showing
4 changed files
with
20 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletion
19
...vascript/controllers/filter_controller.js → ...ascript/controllers/command_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import { debounce } from "https://cdn.skypack.dev/[email protected]?min" | ||
import Combobox from "https://cdn.skypack.dev/@github/[email protected]?min" | ||
|
||
export default class extends Controller { | ||
static targets = [ "list" ] | ||
static targets = [ "input", "list" ] | ||
static classes = [ "active", "selected" ] | ||
|
||
initialize() { | ||
this.filter = debounce(this.filter.bind(this), 300) | ||
} | ||
|
||
connect() { | ||
this.combobox = new Combobox(this.inputTarget, this.listTarget) | ||
} | ||
|
||
disconnect() { | ||
this.combobox.destroy() | ||
} | ||
|
||
start() { | ||
this.combobox.start() | ||
} | ||
|
||
stop() { | ||
this.combobox.stop() | ||
} | ||
|
||
filter({ target }) { | ||
this.#reset() | ||
|
||
|
22 changes: 0 additions & 22 deletions
22
lib/generators/css_zero/add/templates/app/javascript/controllers/listbox_controller.js
This file was deleted.
Oops, something went wrong.