Wire up collection filtering: it should be performed in the generic cards view
This commit is contained in:
@@ -5,7 +5,7 @@ import { post } from "@rails/request.js"
|
||||
export default class extends Controller {
|
||||
static classes = ["filtersSet"]
|
||||
static targets = ["field", "form"]
|
||||
static values = { refreshUrl: String, noFilteringUrl: String }
|
||||
static values = { refreshUrl: String, noFilteringUrl: String, cardsUrl: String }
|
||||
|
||||
initialize() {
|
||||
this.debouncedToggle = debounce(this.#toggle.bind(this), 50)
|
||||
@@ -31,6 +31,12 @@ export default class extends Controller {
|
||||
this.debouncedToggle()
|
||||
}
|
||||
|
||||
submitToGenericCardsView() {
|
||||
this.formTarget.action = this.cardsUrlValue
|
||||
this.formTarget.dataset.turboFrame = "top"
|
||||
this.formTarget.requestSubmit()
|
||||
}
|
||||
|
||||
#toggle() {
|
||||
this.element.classList.toggle(this.filtersSetClass, this.#hasFiltersSet)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user