feat: improve field order for approvals and add seeds
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-03-12 16:15:57 +01:00
parent a5ce7cb921
commit a7481f6ab1
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
8 changed files with 245 additions and 109 deletions

View file

@ -93,6 +93,7 @@ defmodule MvWeb.GlobalSettingsLive do
|> assign(:smtp_test_result, nil)
|> assign(:smtp_test_to_email, "")
|> assign_join_form_state(settings, custom_fields)
|> assign(:join_url, url(socket.endpoint, ~p"/join"))
|> assign_form()
{:ok, socket}
@ -153,6 +154,33 @@ defmodule MvWeb.GlobalSettingsLive do
</div>
<div :if={@join_form_enabled}>
<%!-- Copyable join page link (below checkbox, above field list) --%>
<div class="mb-4 p-3 max-w-2xl rounded-lg border border-base-300 bg-base-200/50">
<p class="text-sm text-base-content/70 mb-2">
{gettext("Link to the public join page (share this with applicants):")}
</p>
<div class="flex flex-wrap items-center gap-2">
<input
type="text"
readonly
value={@join_url}
class="input input-bordered input-sm flex-1 min-w-0 font-mono text-sm"
aria-label={gettext("Join page URL")}
/>
<.button
variant="secondary"
size="sm"
id="copy-join-url-btn"
phx-hook="CopyToClipboard"
phx-click="copy_join_url"
aria-label={gettext("Copy join page URL")}
>
<.icon name="hero-clipboard-document" class="size-4" />
{gettext("Copy")}
</.button>
</div>
</div>
<%!-- Field list header + Add button (left-aligned) --%>
<h3 class="font-medium mb-3">{gettext("Fields on the join form")}</h3>
<div class="relative mb-3 w-fit" phx-click-away="hide_add_field_dropdown">
@ -796,6 +824,16 @@ defmodule MvWeb.GlobalSettingsLive do
# ---- Join form event handlers ----
@impl true
def handle_event("copy_join_url", _params, socket) do
socket =
socket
|> push_event("copy_to_clipboard", %{text: socket.assigns.join_url})
|> put_flash(:success, gettext("Join page URL copied to clipboard."))
{:noreply, socket}
end
@impl true
def handle_event("toggle_join_form_enabled", _params, socket) do
socket = assign(socket, :join_form_enabled, not socket.assigns.join_form_enabled)