Enumerate built-in Commons templates, drop custom-wikitext escape hatch (T426449)
Summary
-
Drop the custom-wikitext-template escape hatch. Removes the
Custom templateradio card, the inline+ Add custom wikitext-template columnform (CustomColumnCreator), the AddColumnPopover "Custom wikitext-template column" entry-point (introduced in T426421/!49 (merged)), and the user-creatablekind: '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.js—BUILTIN_TEMPLATESextended from 4 → 8; eachfields[]entry now carriesrequired+hint;resolveTemplateno longer special-casesid: 'Custom'(unknown ids fall through to{{Information}});renderTemplateBlockno longer carries the custom-body branch; newtemplateDocsUrl(tmpl, param?)helper. -
src/columns-modal.jsx—TemplatesPanelrewritten from radio-card grid to expandable list; newTemplateRowcomponent;CustomColumnCreator+TemplateOptiondeleted;initialCustomFormOpen/onAddTemplateColumnprops removed;TemplateBadge'splaceholderkind removed. -
src/table.jsx—getAllColumnsfilters outkind: 'template'from customProps;addTemplateColumndeleted;CellEditorno longer special-cases template columns (Wikidata-property is the only surviving custom kind);AddColumnPopover"Custom wikitext-template column" entry deleted, along with thecolMenuCustomFormOpenstate andonOpenCustomTemplateFormprop. -
src/api/publish.js—buildCustomTemplateWikitextremoved;templateColumnsplumbing dropped frombuildWikitext,publishOne,publishMany. -
src/app.jsx,src/ui/{publish-modal,bulk-publish-modal,wikitext-preview-modal}.jsx—templateColumnsprop 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 openshttps://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-templatewith 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 columnbutton. - + 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-editUser:<you>/UploadWorkbench/Preferences.jsonto setwikitextTemplate = { "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 acustomPropsentry withkind: '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.