feat: add user-member linking UI with autocomplete (#168)

This commit is contained in:
Moritz 2025-11-20 15:55:50 +01:00
parent 52a62bd679
commit af193840e2
Signed by: moritz
GPG key ID: 1020A035E5DD0824
4 changed files with 271 additions and 8 deletions

View file

@ -23,11 +23,21 @@ import {LiveSocket} from "phoenix_live_view"
import topbar from "../vendor/topbar"
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {
longPollFallbackMs: 2500,
params: {_csrf_token: csrfToken}
})
// Listen for custom events from LiveView
window.addEventListener("phx:set-input-value", (e) => {
const {id, value} = e.detail
const input = document.getElementById(id)
if (input) {
input.value = value
}
})
// Show progress bar on live navigation and form submits
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
window.addEventListener("phx:page-loading-start", _info => topbar.show(300))