Merge branch 'main' into unique-notifications
This commit is contained in:
@@ -2,7 +2,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
import { post } from "@rails/request.js"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "turboFrame", "searchInput", "buttonsContainer" ]
|
||||
static targets = [ "turboFrame", "search", "searchInput", "form", "buttonsContainer" ]
|
||||
static outlets = [ "dialog" ]
|
||||
static values = {
|
||||
searchUrl: String,
|
||||
@@ -17,18 +17,13 @@ export default class extends Controller {
|
||||
this.dialogOutlet.close()
|
||||
this.#clearTurboFrame()
|
||||
|
||||
this.searchInputTarget.querySelector("input").value = ""
|
||||
this.#showItem(this.buttonsContainerTarget)
|
||||
this.#hideItem(this.searchInputTarget)
|
||||
this.#hideItem(this.searchTarget)
|
||||
}
|
||||
|
||||
showModalAndSubmit(event) {
|
||||
event.preventDefault()
|
||||
|
||||
const form = event.target.closest("form")
|
||||
|
||||
this.showModal()
|
||||
form.requestSubmit()
|
||||
this.formTarget.requestSubmit()
|
||||
}
|
||||
|
||||
showModal() {
|
||||
@@ -36,10 +31,18 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
search(event) {
|
||||
this.#openInTurboFrame(this.searchUrlValue)
|
||||
|
||||
this.#showItem(this.searchInputTarget)
|
||||
this.#showItem(this.searchTarget)
|
||||
this.#hideItem(this.buttonsContainerTarget)
|
||||
|
||||
if (this.searchInputTarget.value.trim()) {
|
||||
this.showModalAndSubmit()
|
||||
} else {
|
||||
this.#loadTurboFrame()
|
||||
}
|
||||
}
|
||||
|
||||
#loadTurboFrame() {
|
||||
this.turboFrameTarget.src = this.searchUrlValue
|
||||
}
|
||||
|
||||
#clearTurboFrame() {
|
||||
@@ -47,10 +50,6 @@ export default class extends Controller {
|
||||
this.turboFrameTarget.innerHtml = ""
|
||||
}
|
||||
|
||||
#openInTurboFrame(url) {
|
||||
this.turboFrameTarget.src = url
|
||||
}
|
||||
|
||||
#showItem(element) {
|
||||
element.removeAttribute("hidden")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class extends Controller {
|
||||
static classes = [ "collapsed", "noTransitions" ]
|
||||
static targets = [ "column", "button" ]
|
||||
static values = {
|
||||
collection: String
|
||||
board: String
|
||||
}
|
||||
|
||||
initialize() {
|
||||
@@ -104,6 +104,6 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
#localStorageKeyFor(column) {
|
||||
return `expand-${this.collectionValue}-${column.getAttribute("id")}`
|
||||
return `expand-${this.boardValue}-${column.getAttribute("id")}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class extends Controller {
|
||||
|
||||
checkNone() {
|
||||
this.checkboxTargets.forEach(checkbox => {
|
||||
if (checkbox.dataset.collectionsFormTarget === "meCheckbox") return
|
||||
if (checkbox.dataset.boardsFormTarget === "meCheckbox") return
|
||||
checkbox.checked = false
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user