Enumerate built-in Commons templates, drop custom-wikitext escape hatch (T426449)

Summary

  • Drop the custom-wikitext-template escape hatch. Removes the Custom template radio card, the inline + Add custom wikitext-template column form (CustomColumnCreator), the AddColumnPopover "Custom wikitext-template column" entry-point (introduced in T426421/!49 (merged)), and the user-creatable kind: 'template' custom-column path. Back-compat is silent fallback to {{Information}} per maintainer Q-2 → option (a).
  • Add four built-in templates{{Map}}, {{Art photo}}, {{Specimen}}, {{Musical work}} — with full param sets, required/optional flags, and one-line expected-value hints from each docs page. Coverage is now the eight primary Commons file-description templates instead of four.
  • Redesign the Templates tab as an expandable list. Each row collapses to {{Name}} — one-line use-case; clicking expands to a "Use this template" action, a live wikitext preview, a per-parameter table (|param= → workbench column + required/optional badge + docs hint), and a deep link to the Commons docs page (with per-param #<param> anchors).

Phabricator

  • T426449 — no custom wikitext-template columns

Maintainer pre-decisions on the task (Q-1 / Q-2 / Q-3, see task comments):

  • Q-1 → Option C (full scope: removal + new templates + per-param docs).
  • Q-2 → Option (a) silent fallback + drop (no migration banner, no preserved-data hint).
  • Q-3 → !49 (merged) has already landed in main; fix the AddColumnPopover entry there in this MR. Done.

Code-shape changes

  • src/wikitext-templates.jsBUILTIN_TEMPLATES extended from 4 → 8; each fields[] entry now carries required + hint; resolveTemplate no longer special-cases id: 'Custom' (unknown ids fall through to {{Information}}); renderTemplateBlock no longer carries the custom-body branch; new templateDocsUrl(tmpl, param?) helper.
  • src/columns-modal.jsxTemplatesPanel rewritten from radio-card grid to expandable list; new TemplateRow component; CustomColumnCreator + TemplateOption deleted; initialCustomFormOpen/onAddTemplateColumn props removed; TemplateBadge's placeholder kind removed.
  • src/table.jsxgetAllColumns filters out kind: 'template' from customProps; addTemplateColumn deleted; CellEditor no longer special-cases template columns (Wikidata-property is the only surviving custom kind); AddColumnPopover "Custom wikitext-template column" entry deleted, along with the colMenuCustomFormOpen state and onOpenCustomTemplateForm prop.
  • src/api/publish.jsbuildCustomTemplateWikitext removed; templateColumns plumbing dropped from buildWikitext, publishOne, publishMany.
  • src/app.jsx, src/ui/{publish-modal,bulk-publish-modal,wikitext-preview-modal}.jsxtemplateColumns prop removed everywhere it was passed.
  • src/app.css — new .tmpl-list / .tmpl-row* / .tmpl-params* styles for the expandable layout; obsolete .tmpl-option* / .cols-modal__add-custom* rules dropped.

Test plan

  • Templates tab — fresh state. Open Templates tab on a new account/private window. All 8 templates render in this order: Information (auto-expanded, "selected" pill, left rail), Photograph, Artwork, Book, Map, Art photo, Specimen, Musical work.
  • Switch templates. Click "Use {{Map}}" inside the Map row's expanded panel. The wikitext column in the table updates (start of preview now reads {{Map). The left rail and "selected" pill jump to {{Map}}.
  • Expand all 8 rows in turn. Each shows: a wikitext preview, a parameter table with |param= (with docs link), the matching workbench column (where one exists; "(no column)" otherwise), a required/optional badge, and a visibility tick. Per-param docs anchor opens https://commons.wikimedia.org/wiki/Template:<Name>#<param> in a new tab. The "Commons docs" link opens the docs root.
  • Recommended columns block. For each template, expand and confirm: when at least one recommended column is hidden, the "Add N columns" CTA appears + dispatches to the Columns tab pre-filtered to in-template with the flash highlight; when all are visible, the green "All N columns are already enabled" line shows instead.
  • Columns tab — no inline custom-template form. The bottom of the Columns tab no longer has the + Add custom wikitext-template column button.
  • + Add column popover. Open the trailing "+ Add column" button on the table head. The "Custom wikitext-template column" entry is gone; "More options (Templates and columns)" still routes correctly.
  • Back-compat for stored id: 'Custom'. Hand-edit User:<you>/UploadWorkbench/Preferences.json to set wikitextTemplate = { "id": "Custom", "body": "{{X}}", "fields": [] }, reload — the app boots clean, the wikitext column renders against {{Information}}, no console error. (Optional but the cleanest verification.)
  • Back-compat for stored kind: 'template'. Hand-edit the same prefs page to inject a customProps entry with kind: 'template', reload — the legacy column is hidden, no console error, and the entry stays on the wiki page (visible via ?action=history).
  • Publish flow unaffected. Pick a stash file, set template to {{Photograph}}, fill required columns, click Publish → confirm wikitext block opens with {{Photograph}} wrapper, click Publish → file lands on Commons, no warnings about missing templateColumns.

🤖 Generated with Claude Code

Merge request reports

Loading