Add comprehensive module documentation to 12 LiveView modules covering member, user, property, and property_type management views.
64 lines
1.6 KiB
Elixir
64 lines
1.6 KiB
Elixir
defmodule MvWeb.PropertyLive.Show do
|
|
@moduledoc """
|
|
LiveView for displaying a single property's details.
|
|
|
|
## Features
|
|
- Display property value and type
|
|
- Show linked member
|
|
- Show property type definition
|
|
- Navigate to edit form
|
|
- Return to property list
|
|
|
|
## Displayed Information
|
|
- Property value (formatted based on type)
|
|
- Property type name and description
|
|
- Member information (who owns this property)
|
|
- Property metadata (ID, timestamps if added)
|
|
|
|
## Navigation
|
|
- Back to property list
|
|
- Edit property
|
|
"""
|
|
use MvWeb, :live_view
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<Layouts.app flash={@flash} current_user={@current_user}>
|
|
<.header>
|
|
Property {@property.id}
|
|
<:subtitle>This is a property record from your database.</:subtitle>
|
|
|
|
<:actions>
|
|
<.button navigate={~p"/properties"}>
|
|
<.icon name="hero-arrow-left" />
|
|
</.button>
|
|
<.button variant="primary" navigate={~p"/properties/#{@property}/edit?return_to=show"}>
|
|
<.icon name="hero-pencil-square" /> Edit Property
|
|
</.button>
|
|
</:actions>
|
|
</.header>
|
|
|
|
<.list>
|
|
<:item title="Id">{@property.id}</:item>
|
|
</.list>
|
|
</Layouts.app>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def mount(_params, _session, socket) do
|
|
{:ok, socket}
|
|
end
|
|
|
|
@impl true
|
|
def handle_params(%{"id" => id}, _, socket) do
|
|
{:noreply,
|
|
socket
|
|
|> assign(:page_title, page_title(socket.assigns.live_action))
|
|
|> assign(:property, Ash.get!(Mv.Membership.Property, id))}
|
|
end
|
|
|
|
defp page_title(:show), do: "Show Property"
|
|
defp page_title(:edit), do: "Edit Property"
|
|
end
|