All checks were successful
continuous-integration/drone/push Build is passing
Complete refactoring of resources, database tables, code references, tests, and documentation for improved naming consistency.
66 lines
1.8 KiB
Elixir
66 lines
1.8 KiB
Elixir
defmodule MvWeb.CustomFieldLive.Show do
|
|
@moduledoc """
|
|
LiveView for displaying a single custom field's details (admin).
|
|
|
|
## Features
|
|
- Display custom field definition
|
|
- Show all attributes (name, value type, description, flags)
|
|
- Navigate to edit form
|
|
- Return to custom field list
|
|
|
|
## Displayed Information
|
|
- Name: Unique identifier
|
|
- Value type: Data type constraint
|
|
- Description: Optional explanation
|
|
- Immutable flag: Whether values can be changed
|
|
- Required flag: Whether all members need this custom field
|
|
|
|
## Navigation
|
|
- Back to custom field list
|
|
- Edit custom field
|
|
|
|
## Security
|
|
Custom field details are restricted to admin users.
|
|
"""
|
|
use MvWeb, :live_view
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<Layouts.app flash={@flash} current_user={@current_user}>
|
|
<.header>
|
|
Custom field {@custom_field.id}
|
|
<:subtitle>This is a custom_field record from your database.</:subtitle>
|
|
|
|
<:actions>
|
|
<.button navigate={~p"/custom_fields"}>
|
|
<.icon name="hero-arrow-left" />
|
|
</.button>
|
|
<.button
|
|
variant="primary"
|
|
navigate={~p"/custom_fields/#{@custom_field}/edit?return_to=show"}
|
|
>
|
|
<.icon name="hero-pencil-square" /> Edit Custom field
|
|
</.button>
|
|
</:actions>
|
|
</.header>
|
|
|
|
<.list>
|
|
<:item title="Id">{@custom_field.id}</:item>
|
|
|
|
<:item title="Name">{@custom_field.name}</:item>
|
|
|
|
<:item title="Description">{@custom_field.description}</:item>
|
|
</.list>
|
|
</Layouts.app>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def mount(%{"id" => id}, _session, socket) do
|
|
{:ok,
|
|
socket
|
|
|> assign(:page_title, "Show Custom field")
|
|
|> assign(:custom_field, Ash.get!(Mv.Membership.CustomField, id))}
|
|
end
|
|
end
|