feat: hide slug from user

This commit is contained in:
Moritz 2025-11-20 14:13:56 +01:00
parent edf8b2b79e
commit c246ca59db
Signed by: moritz
GPG key ID: 1020A035E5DD0824
3 changed files with 6 additions and 20 deletions

View file

@ -19,9 +19,6 @@ defmodule MvWeb.CustomFieldLive.Form do
- immutable - If true, values cannot be changed after creation (default: false) - immutable - If true, values cannot be changed after creation (default: false)
- required - If true, all members must have this custom field (default: false) - required - If true, all members must have this custom field (default: false)
**Read-only (Edit mode only):**
- slug - Auto-generated URL-friendly identifier (immutable)
## Value Type Selection ## Value Type Selection
- `:string` - Text data (unlimited length) - `:string` - Text data (unlimited length)
- `:integer` - Numeric data - `:integer` - Numeric data
@ -52,19 +49,6 @@ defmodule MvWeb.CustomFieldLive.Form do
<.form for={@form} id="custom_field-form" phx-change="validate" phx-submit="save"> <.form for={@form} id="custom_field-form" phx-change="validate" phx-submit="save">
<.input field={@form[:name]} type="text" label={gettext("Name")} /> <.input field={@form[:name]} type="text" label={gettext("Name")} />
<%!-- Show slug in edit mode (read-only) --%>
<div :if={@custom_field} class="mb-4">
<label class="block text-sm font-semibold leading-6 text-zinc-800">
{gettext("Slug")}
</label>
<div class="mt-2 p-3 bg-zinc-50 border border-zinc-300 rounded-lg text-sm text-zinc-700">
{@custom_field.slug}
</div>
<p class="mt-2 text-sm leading-6 text-zinc-600">
{gettext("Auto-generated identifier (immutable)")}
</p>
</div>
<.input <.input
field={@form[:value_type]} field={@form[:value_type]}
type="select" type="select"

View file

@ -11,7 +11,6 @@ defmodule MvWeb.CustomFieldLive.Index do
- Delete custom fields (if no custom field values use them) - Delete custom fields (if no custom field values use them)
## Displayed Information ## Displayed Information
- Slug: URL-friendly identifier (auto-generated from name)
- Name: Unique identifier for the custom field - Name: Unique identifier for the custom field
- Value type: Data type constraint (string, integer, boolean, date, email) - Value type: Data type constraint (string, integer, boolean, date, email)
- Description: Human-readable explanation - Description: Human-readable explanation
@ -44,8 +43,6 @@ defmodule MvWeb.CustomFieldLive.Index do
rows={@streams.custom_fields} rows={@streams.custom_fields}
row_click={fn {_id, custom_field} -> JS.navigate(~p"/custom_fields/#{custom_field}") end} row_click={fn {_id, custom_field} -> JS.navigate(~p"/custom_fields/#{custom_field}") end}
> >
<:col :let={{_id, custom_field}} label="Slug">{custom_field.slug}</:col>
<:col :let={{_id, custom_field}} label="Name">{custom_field.name}</:col> <:col :let={{_id, custom_field}} label="Name">{custom_field.name}</:col>
<:col :let={{_id, custom_field}} label="Description">{custom_field.description}</:col> <:col :let={{_id, custom_field}} label="Description">{custom_field.description}</:col>

View file

@ -50,7 +50,12 @@ defmodule MvWeb.CustomFieldLive.Show do
<.list> <.list>
<:item title="Id">{@custom_field.id}</:item> <:item title="Id">{@custom_field.id}</:item>
<:item title="Slug">{@custom_field.slug}</:item> <:item title="Slug">
{@custom_field.slug}
<p class="mt-2 text-sm leading-6 text-zinc-600">
{gettext("Auto-generated identifier (immutable)")}
</p>
</:item>
<:item title="Name">{@custom_field.name}</:item> <:item title="Name">{@custom_field.name}</:item>