Scope: Drop the custom-wikitext-template escape hatch in favour of a comprehensive, well-documented set of built-in Commons templates with a redesigned Templates-tab UI.
Why: "Custom wikitext-template" requires the user to know template syntax — there's no good UX for it. Every template Commons cares about is enumerable, so the right move is to enumerate them all and expose them as first-class options.
What needs to change
1. Remove all "custom wikitext-template" surface area:
- Delete the Custom template radio-card option from the Templates tab (src/columns-modal.jsx:537-543).
- Delete the inline + Add custom wikitext-template column form (CustomColumnCreator) at the bottom of the Columns tab (src/columns-modal.jsx:307-312, 332-422).
- Delete the Custom wikitext-template column entry-point from the new "+ Add column" popover (AddColumnPopover at src/table.jsx:4912-4922 on branch feat/T426421-new-column-button / MR !49).
2. Add the missing templates so the Templates tab covers all primary file-description templates Commons uses. Currently 4 (Information, Artwork, Photograph, Book — see src/wikitext-templates.js:40-153); should add: Map, Art photo, Specimen, Musical work. Each needs:
- Entry in BUILTIN_TEMPLATES with all named parameters from its docs page.
- fields[] mapping each param to the matching workbench column key (or key: null if the workbench has no equivalent).
- requiredColumns + recommendedColumns.
3. Redesign the Templates tab from cards to expandable list:
- Each list row: template name (e.g. {{Map}}) + one-line use-case description.
- Click → expand to show: live wikitext preview block (already computed by renderTemplateBlock), per-param table mapping template_param ↔ workbench column with visibility checkmark, "Open Commons docs" link to https://commons.wikimedia.org/wiki/Template:<Name>.
- Order rows by prevalence: Information > Photograph > Artwork > Book > Map > Art photo > Specimen > Musical work.
4. Surface field-level documentation:
- In the expanded row, show per-param required/optional badge + the docs page's one-line "expected value" hint (e.g. ISO 8601 for date).
- Per-param docs anchor: Template:<Name>#<param>.
- Best-effort enforcement: where the workbench has a structured column (e.g. dateTaken is a date input, objectLocation is a coords pair), the existing column editor is the constraint. Free-text columns stay free-text.
5. Back-compat:
- Users with stored wikitextTemplate = { id: 'Custom', body, fields } in User:<self>/UploadWorkbench/Preferences.json: silently fall back to Information on load. Don't crash; don't drop their custom body without warning.
- Users with customProps of kind: 'template' (custom-wikitext columns saved as table columns): see Q-2 in the maintainer-question comment.
Where in the code
| Concern | File / range |
|---|---|
| Template registry | src/wikitext-templates.js:40-153 (BUILTIN_TEMPLATES) |
| Custom template fallback | src/wikitext-templates.js:229-244 (resolveTemplate) |
| Templates-tab UI (cards) | src/columns-modal.jsx:447-667 (TemplatesPanel, TemplateOption) |
| Custom-column creator (inline form) | src/columns-modal.jsx:307-312, 332-422 (CustomColumnCreator) |
| "+ Add column" popover entry | src/table.jsx:4912-4922 on branch feat/T426421-new-column-button (not yet on main) |
| Wikitext rendering (downstream) | src/api/publish.js:157-168 (buildWikitext) — no changes needed for new builtin templates |
| Persistence | src/api/user-store.js (Preferences.json) — read path needs the back-compat fallback |
Acceptance criteria
- Templates tab no longer offers Custom template.
- Inline + Add custom wikitext-template column form is gone from the Columns tab.
- Custom wikitext-template column entry is gone from the "+ Add column" popover.
- All 8 templates above appear in the Templates tab, ordered by prevalence, as an expandable list (not cards).
- Each expanded row shows wikitext preview, param→column mapping, and docs link.
- Per-param required/optional badge + expected-value hint in the expanded row.
- Existing user preferences with id: 'Custom' don't crash the app — fall back to Information.
- npm run build passes (undefined-identifier scanner runs first).
Out of scope
- Adding new workbench column types for template-only concepts (taxon, projection, composer, etc.). Those params stay unmapped; user fills them via free-text or a future MR.
- Bulk migration of users' existing customProps of kind: 'template' (custom-wikitext columns). See Q-2.