Jump to content

ICT:THE pattern

From Costa Sano MediaWiki
Revision as of 17:03, 8 February 2026 by Mngr (talk | contribs) (Created page with "= ICT: Pattern — Dashboard, Page Form, Template, Cargo Table = This page documents the standard pattern for creating structured data modules in the Costa Sano Research Archive. It applies to all entities stored in Cargo tables (e.g., Chapters, Persons, Locations, Events, Assets). The pattern consists of four coordinated components: # Template — stores data and writes to Cargo # Form — provides a clean, simple editing UI # Dashboard — lists records and links...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ICT: Pattern — Dashboard, Page Form, Template, Cargo Table

This page documents the standard pattern for creating structured data modules in the Costa Sano Research Archive. It applies to all entities stored in Cargo tables (e.g., Chapters, Persons, Locations, Events, Assets).

The pattern consists of four coordinated components:

  1. Template — stores data and writes to Cargo
  2. Form — provides a clean, simple editing UI
  3. Dashboard — lists records and links to the form
  4. Cargo table — automatically created from the template declaration

This pattern is stable, reproducible, and successor‑friendly.


1. Template (Template:EntityName)

The template defines:

  • the Cargo table structure (via #cargo_declare)
  • how data is stored (via #cargo_store)
  • the form association (via #forminput:form=…)
  • the display of the page itself

Structure

<noinclude>
Documentation text…

{{#cargo_declare:
 _table=TableName
 |field1=String
 |field2=Text
 |field3=Date
 |field4=Page
}}

{{#forminput:form=EntityName}}
</noinclude>

{{#cargo_store:
 field1={{{field1|}}}
 |field2={{{field2|}}}
 |field3={{{field3|}}}
 |field4={{{field4|}}}
}}

== {{{field1|}}} ==

Notes

  • The #forminput:form=EntityName line is required so Page Forms knows which form edits pages using this template.
  • Only fields declared in #cargo_declare may be stored.
  • The template name must match the form’s .

2. Form (Form:EntityName)

The form provides a clean, simple UI for creating and editing records. It must:

  • include an info block to hide clutter
  • include a standard input|save button
  • wrap fields inside a for template block

Structure

<noinclude>
Form for creating and editing EntityName pages.
</noinclude>

{{{info
|no summary
|no preview
|no minor edit
|no watch
|no footer
}}}

{{{for template|EntityName}}}

{| class="formtable"
! Field 1
| {{{field|field1|mandatory}}}
|-
! Field 2
| {{{field|field2|input type=textarea}}}
|-
! Field 3
| {{{field|field3|input type=datepicker}}}
|-
! Field 4
| {{{field|field4|input type=combobox|values from namespace=EntityName}}}
|}

{{{standard input|save}}}

{{{end template}}}

Notes

  • The info block must appear before the for template block.
  • The standard input|save line is required; without it, Page Forms falls back to the MediaWiki editor footer.
  • The form name must match the template name.

3. Dashboard (Dashboard:EntityName)

The dashboard lists all records and provides a clean entry point to the form.

Structure

= EntityName Dashboard =

{| class="wikitable sortable"
! Field1 !! Field2 !! Field3
{{#cargo_query:
 tables=TableName
 |fields=_pageName,field1,field2,field3
 |where=_pageNamespace=EntityNamespace
 |order by=field1
 |format=template
 |template=EntityRow
 |named args=yes
 |cache=no
}}
|}

{{#forminput:
 form=EntityName
 |namespace=EntityName
 |button text=➕ New EntityName
 |returnto=Dashboard:EntityName
}}

Notes

  • The dashboard never links to action=edit.
  • All editing must go through Page Forms.

4. Row Template (Template:EntityRow)

This template defines how each row in the dashboard table is rendered.

Structure

<includeonly>
|-
| {{#formlink:form=EntityName
    |target={{{_pageName}}}
    |link text={{{field1}}}
    |returnto=Dashboard:EntityName
  }}
| {{{field2}}}
| {{{field3}}}
</includeonly>

Notes

  • The first column is the clickable link that opens the form editor.
  • #formlink ensures the user always enters action=formedit.

5. Workflow Summary

Creating a new record

  • User clicks "New EntityName"
  • URL: Special:FormEdit/EntityName/EntityName:XYZ
  • Clean Page Forms UI appears
  • Data is stored via #cargo_store
  • Cargo table updates automatically

Editing an existing record

  • User clicks the code in the dashboard
  • URL: EntityName:XYZ?action=formedit
  • Clean Page Forms UI appears
  • Data updates in Cargo

No user ever sees the MediaWiki editor.


6. Rules for Reuse

To create a new module (e.g., Persons, Locations, Events):

  1. Copy the Template pattern → adjust fields
  2. Copy the Form pattern → adjust fields
  3. Copy the Dashboard pattern → adjust table and row template
  4. Create a Row template using #formlink
  5. Verify:
    1. Template name = Form name
    2. Cargo table name is unique
    3. Dashboard uses the correct namespace
    4. Form includes standard input|save

This pattern is stable, reproducible, and successor‑friendly.