docs: add @moduledoc to all LiveView modules
Add comprehensive module documentation to 12 LiveView modules covering member, user, property, and property_type management views.
This commit is contained in:
parent
8fd981806e
commit
1805916359
12 changed files with 308 additions and 0 deletions
|
|
@ -1,4 +1,33 @@
|
||||||
defmodule MvWeb.MemberLive.Form do
|
defmodule MvWeb.MemberLive.Form do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView form for creating and editing members.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Create new members with personal information
|
||||||
|
- Edit existing member details
|
||||||
|
- Manage custom properties (dynamic fields)
|
||||||
|
- Real-time validation with visual feedback
|
||||||
|
- Link/unlink user accounts
|
||||||
|
|
||||||
|
## Form Fields
|
||||||
|
**Required:**
|
||||||
|
- first_name, last_name, email
|
||||||
|
|
||||||
|
**Optional:**
|
||||||
|
- birth_date, phone_number, address fields (city, street, house_number, postal_code)
|
||||||
|
- join_date, exit_date
|
||||||
|
- paid status
|
||||||
|
- notes
|
||||||
|
|
||||||
|
## Custom Properties
|
||||||
|
Members can have dynamic custom properties defined by PropertyTypes.
|
||||||
|
The form dynamically renders inputs based on available PropertyTypes.
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `validate` - Real-time form validation
|
||||||
|
- `save` - Submit form (create or update member)
|
||||||
|
- Property management events for adding/removing custom fields
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,29 @@
|
||||||
defmodule MvWeb.MemberLive.Index do
|
defmodule MvWeb.MemberLive.Index do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying and managing the member list.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Full-text search across member profiles using PostgreSQL tsvector
|
||||||
|
- Sortable columns (name, email, address fields)
|
||||||
|
- Bulk selection for future batch operations
|
||||||
|
- Real-time updates via LiveView
|
||||||
|
- Bookmarkable URLs with query parameters
|
||||||
|
|
||||||
|
## URL Parameters
|
||||||
|
- `query` - Search query string for full-text search
|
||||||
|
- `sort_field` - Field to sort by (e.g., :first_name, :email, :join_date)
|
||||||
|
- `sort_order` - Sort direction (:asc or :desc)
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `delete` - Remove a member from the database
|
||||||
|
- `select_member` - Toggle individual member selection
|
||||||
|
- `select_all` - Toggle selection of all visible members
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
- Search uses PostgreSQL full-text search (plainto_tsquery)
|
||||||
|
- Sort state is synced with URL for bookmarkability
|
||||||
|
- Components communicate via `handle_info` for decoupling
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,26 @@
|
||||||
defmodule MvWeb.MemberLive.Show do
|
defmodule MvWeb.MemberLive.Show do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying a single member's details.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Display all member information (personal, contact, address)
|
||||||
|
- Show linked user account (if exists)
|
||||||
|
- Display custom properties
|
||||||
|
- Navigate to edit form
|
||||||
|
- Return to member list
|
||||||
|
|
||||||
|
## Displayed Information
|
||||||
|
- Basic: name, email, dates (birth, join, exit)
|
||||||
|
- Contact: phone number
|
||||||
|
- Address: street, house number, postal code, city
|
||||||
|
- Status: paid flag
|
||||||
|
- Relationships: linked user account
|
||||||
|
- Custom: dynamic properties from PropertyTypes
|
||||||
|
|
||||||
|
## Navigation
|
||||||
|
- Back to member list
|
||||||
|
- Edit member (with return_to parameter for back navigation)
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
import Ash.Query
|
import Ash.Query
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,35 @@
|
||||||
defmodule MvWeb.PropertyLive.Form do
|
defmodule MvWeb.PropertyLive.Form do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView form for creating and editing properties.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Create new properties with member and type selection
|
||||||
|
- Edit existing property values
|
||||||
|
- Value input adapts to property type (string, integer, boolean, date, email)
|
||||||
|
- Real-time validation
|
||||||
|
|
||||||
|
## Form Fields
|
||||||
|
**Required:**
|
||||||
|
- member - Select which member owns this property
|
||||||
|
- property_type - Select the type (defines value type)
|
||||||
|
- value - The actual value (input type depends on property type)
|
||||||
|
|
||||||
|
## Value Types
|
||||||
|
The form dynamically renders appropriate inputs based on property type:
|
||||||
|
- String: text input
|
||||||
|
- Integer: number input
|
||||||
|
- Boolean: checkbox
|
||||||
|
- Date: date picker
|
||||||
|
- Email: email input with validation
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `validate` - Real-time form validation
|
||||||
|
- `save` - Submit form (create or update property)
|
||||||
|
|
||||||
|
## Note
|
||||||
|
Properties are typically managed through the member edit form,
|
||||||
|
not through this standalone form.
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,26 @@
|
||||||
defmodule MvWeb.PropertyLive.Index do
|
defmodule MvWeb.PropertyLive.Index do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying and managing properties.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- List all properties with their values and types
|
||||||
|
- Show which member each property belongs to
|
||||||
|
- Display property type information
|
||||||
|
- Navigate to property details and edit forms
|
||||||
|
- Delete properties
|
||||||
|
|
||||||
|
## Relationships
|
||||||
|
Each property is linked to:
|
||||||
|
- A member (the property owner)
|
||||||
|
- A property type (defining value type and behavior)
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `delete` - Remove a property from the database
|
||||||
|
|
||||||
|
## Note
|
||||||
|
Properties are typically managed through the member edit form.
|
||||||
|
This view provides a global overview of all properties.
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,24 @@
|
||||||
defmodule MvWeb.PropertyLive.Show do
|
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
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,38 @@
|
||||||
defmodule MvWeb.PropertyTypeLive.Form do
|
defmodule MvWeb.PropertyTypeLive.Form do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView form for creating and editing property types (admin).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Create new property type definitions
|
||||||
|
- Edit existing property types
|
||||||
|
- Select value type from supported types
|
||||||
|
- Set immutable and required flags
|
||||||
|
- Real-time validation
|
||||||
|
|
||||||
|
## Form Fields
|
||||||
|
**Required:**
|
||||||
|
- name - Unique identifier (e.g., "phone_mobile", "emergency_contact")
|
||||||
|
- value_type - Data type (:string, :integer, :boolean, :date, :email)
|
||||||
|
|
||||||
|
**Optional:**
|
||||||
|
- description - Human-readable explanation
|
||||||
|
- immutable - If true, values cannot be changed after creation (default: false)
|
||||||
|
- required - If true, all members must have this property (default: false)
|
||||||
|
|
||||||
|
## Value Type Selection
|
||||||
|
- `:string` - Text data (unlimited length)
|
||||||
|
- `:integer` - Numeric data
|
||||||
|
- `:boolean` - True/false flags
|
||||||
|
- `:date` - Date values
|
||||||
|
- `:email` - Validated email addresses
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `validate` - Real-time form validation
|
||||||
|
- `save` - Submit form (create or update property type)
|
||||||
|
|
||||||
|
## Security
|
||||||
|
Property type management is restricted to admin users.
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,28 @@
|
||||||
defmodule MvWeb.PropertyTypeLive.Index do
|
defmodule MvWeb.PropertyTypeLive.Index do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for managing property type definitions (admin).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- List all property types
|
||||||
|
- Display type information (name, value type, description)
|
||||||
|
- Show immutable and required flags
|
||||||
|
- Create new property types
|
||||||
|
- Edit existing property types
|
||||||
|
- Delete property types (if no properties use them)
|
||||||
|
|
||||||
|
## Displayed Information
|
||||||
|
- Name: Unique identifier for the property type
|
||||||
|
- Value type: Data type constraint (string, integer, boolean, date, email)
|
||||||
|
- Description: Human-readable explanation
|
||||||
|
- Immutable: Whether property values can be changed after creation
|
||||||
|
- Required: Whether all members must have this property (future feature)
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `delete` - Remove a property type (only if no properties exist)
|
||||||
|
|
||||||
|
## Security
|
||||||
|
Property type management is restricted to admin users.
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,27 @@
|
||||||
defmodule MvWeb.PropertyTypeLive.Show do
|
defmodule MvWeb.PropertyTypeLive.Show do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying a single property type's details (admin).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Display property type definition
|
||||||
|
- Show all attributes (name, value type, description, flags)
|
||||||
|
- Navigate to edit form
|
||||||
|
- Return to property type 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 property
|
||||||
|
|
||||||
|
## Navigation
|
||||||
|
- Back to property type list
|
||||||
|
- Edit property type
|
||||||
|
|
||||||
|
## Security
|
||||||
|
Property type details are restricted to admin users.
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,36 @@
|
||||||
defmodule MvWeb.UserLive.Form do
|
defmodule MvWeb.UserLive.Form do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView form for creating and editing users.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Create new users with email
|
||||||
|
- Edit existing user details
|
||||||
|
- Optional password setting (checkbox to toggle)
|
||||||
|
- Link/unlink member accounts
|
||||||
|
- Email synchronization with linked members
|
||||||
|
|
||||||
|
## Form Fields
|
||||||
|
**Required:**
|
||||||
|
- email
|
||||||
|
|
||||||
|
**Optional:**
|
||||||
|
- password (for password authentication strategy)
|
||||||
|
- linked member (select from existing members)
|
||||||
|
|
||||||
|
## Password Management
|
||||||
|
- New users: Can optionally set password with confirmation
|
||||||
|
- Existing users: Can change password (no confirmation required, admin action)
|
||||||
|
- Checkbox toggles password section visibility
|
||||||
|
|
||||||
|
## Member Linking
|
||||||
|
Users can be linked to existing member accounts. When linked, emails are
|
||||||
|
synchronized bidirectionally with User.email as the source of truth.
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `validate` - Real-time form validation
|
||||||
|
- `save` - Submit form (create or update user)
|
||||||
|
- `toggle_password_section` - Show/hide password fields
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,25 @@
|
||||||
defmodule MvWeb.UserLive.Index do
|
defmodule MvWeb.UserLive.Index do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying and managing the user list.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- List all users with email and linked member
|
||||||
|
- Sort users by email (default)
|
||||||
|
- Delete users
|
||||||
|
- Navigate to user details and edit forms
|
||||||
|
- Bulk selection for future batch operations
|
||||||
|
|
||||||
|
## Relationships
|
||||||
|
Displays linked member information when a user is connected to a member account.
|
||||||
|
|
||||||
|
## Events
|
||||||
|
- `delete` - Remove a user from the database
|
||||||
|
- `select_user` - Toggle individual user selection
|
||||||
|
- `select_all` - Toggle selection of all visible users
|
||||||
|
|
||||||
|
## Security
|
||||||
|
User deletion requires admin permissions (enforced by Ash policies).
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
import MvWeb.TableComponents
|
import MvWeb.TableComponents
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,29 @@
|
||||||
defmodule MvWeb.UserLive.Show do
|
defmodule MvWeb.UserLive.Show do
|
||||||
|
@moduledoc """
|
||||||
|
LiveView for displaying a single user's details.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Display user information (email, OIDC ID)
|
||||||
|
- Show authentication methods (password, OIDC)
|
||||||
|
- Display linked member account (if exists)
|
||||||
|
- Navigate to edit form
|
||||||
|
- Return to user list
|
||||||
|
|
||||||
|
## Displayed Information
|
||||||
|
- Email address
|
||||||
|
- OIDC ID (if authenticated via OIDC)
|
||||||
|
- Password authentication status
|
||||||
|
- Linked member (name and email)
|
||||||
|
|
||||||
|
## Authentication Status
|
||||||
|
Shows which authentication methods are enabled for the user:
|
||||||
|
- Password authentication (has hashed_password)
|
||||||
|
- OIDC authentication (has oidc_id)
|
||||||
|
|
||||||
|
## Navigation
|
||||||
|
- Back to user list
|
||||||
|
- Edit user (with return_to parameter for back navigation)
|
||||||
|
"""
|
||||||
use MvWeb, :live_view
|
use MvWeb, :live_view
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue