MishkaGervaz.Form.Templates.Standard (MishkaGervaz v0.0.1-alpha.2)

Copy Markdown View Source

Default form template for MishkaGervaz.

Implements MishkaGervaz.Form.Behaviours.Template and serves as the out-of-the-box renderer for every mishka_gervaz form do … end block. Custom templates inherit from this module via use MishkaGervaz.Form.Behaviours.Template, which delegates the four optional callbacks (render_loading/1, render_field/1, render_group/1, render_step_indicator/1) here.

Layout modes

  • :standard — single-page form, fields rendered in their declared groups (or flat when no groups are declared).
  • :wizard — multi-step form with a sequential step indicator and step-aware submit / next / previous buttons.
  • :tabs — same step structure as :wizard but with free navigation between tabs.

Mode selection is read from @state.static.layout_mode. The render pipeline (render/1) dispatches notices (render_notices_at/2), the form header / footer chrome, the body (render_groups/1 or render_current_step_groups/1), upload sections, and submit buttons in a fixed order so notice positioning stays predictable.

Two-axis composition

Field-type dispatch

render_field/1 delegates per-type rendering to modules under MishkaGervaz.Form.Types.Field.* (e.g. MishkaGervaz.Form.Types.Field.Hidden, MishkaGervaz.Form.Types.Field.Relation). Built-in types are wired through render_input/4; custom types implement MishkaGervaz.Form.Behaviours.FieldType and are referenced directly in the field DSL (field :foo, MyApp.FieldTypes.Color).

See MishkaGervaz.Form.Behaviours.Template, MishkaGervaz.Form.Behaviours.FieldType, MishkaGervaz.Behaviours.UIAdapter, MishkaGervaz.Helpers, and MishkaGervaz.Form.Web.UploadHelpers.