Skip to content

Commit

Permalink
Fix picture description field language select
Browse files Browse the repository at this point in the history
The language id select is not always present
(ie. if only one language is present).
  • Loading branch information
tvdeyen committed Sep 23, 2024
1 parent 770a0d0 commit 5f94d50
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
<script type="module">
const select = document.querySelector("#language_id")

select.addEventListener("change", () => {
const url = new URL(select.dataset.url)
url.searchParams.set("language_id", select.value)
Turbo.visit(url, { frame: "picture_descriptions" })
})
if (select) {
select.addEventListener("change", () => {
const url = new URL(select.dataset.url)
url.searchParams.set("language_id", select.value)
Turbo.visit(url, { frame: "picture_descriptions" })
})
}
</script>

0 comments on commit 5f94d50

Please sign in to comment.