Turn filter chips into links
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "chip" ]
|
||||
|
||||
connect() {
|
||||
this.chipTargets.forEach(button => this.#showChip(button))
|
||||
}
|
||||
|
||||
removeFilter(event) {
|
||||
event.preventDefault()
|
||||
this.#hideChip(event.target.closest("button"))
|
||||
}
|
||||
|
||||
clearCategory({ params: { name } }) {
|
||||
name.split(",").forEach(name => {
|
||||
this.element.querySelectorAll(`input[name="${name}"]`).forEach(input => {
|
||||
@@ -19,14 +8,4 @@ export default class extends Controller {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
#showChip(button) {
|
||||
button.querySelector("input").disabled = false
|
||||
button.hidden = false
|
||||
}
|
||||
|
||||
#hideChip(button) {
|
||||
button.querySelector("input").disabled = true
|
||||
button.hidden = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user