Skip to content

refactor(rozier): move twig templates to role tree - #558

Draft
timothejoubert wants to merge 2 commits into
developfrom
feature/540-twig-templates-tree
Draft

timothejoubert wants to merge 2 commits into
developfrom
feature/540-twig-templates-tree

Conversation

@timothejoubert

Copy link
Copy Markdown
Contributor

Refs #540 — PR 1 of 3 (tree). PR 2 (options keys + header comment) and PR 3 (hand-written roots) follow.

Summary

Shared templates move to the role-based tree of lib/Rozier/docs/templates.md (ADR 0005). layout.html.twig, forms.html.twig and dashboard/index.html.twig stay put.

 templates/
-├── base.html.twig, simple.html.twig, horizontalForms.html.twig
-├── admin/  base, head, meta-icon, rz_header, blocks/
-├── macros/ rz_* (19 files)
-├── includes/ rz_* (6 files)
-├── widgets/ rz_*, drawer, documentAlignment, backlink…
+├── layouts/     base, simple, admin, login, head, meta_icon
+├── patterns/    header, aside, menu_bar, dashboard_nav, dashboard_panel
+├── components/  one file per rz-* root (rz_button, rz_table, rz_dropdown…)
+├── form/        horizontal_forms, document_alignment
+├── macros/      element_attributes
+├── includes/    column_ordering, messages, meta_item_table, translate_assistant_usage
 ├── admin/       confirm_action, bulk_actions, webhooks/  (feature folder)
 └── widgets/     legacy trees only (nodeTree, tagTree, folderTree)

Duplicates merged into one component file:

includes/rz_dropdown + macros/rz_dropdown_menu  → components/rz_dropdown   (pass target_options to get the rz-popover trigger)
macros/rz_breadcrumb + includes/rz_breadcrumb_item → components/rz_breadcrumb (item macro)
widgets/rz_repeatable + macros/rz_repeatable    → components/rz_repeatable (item(options) macro)
widgets/rz_filters_bar + macros/rz_filters_bar  → components/rz_filters_bar
widgets/rz_bulk_actions + macros/rz_bulk        → components/rz_bulk_actions

Removed: the 11 unreferenced templates listed in #540, plus widgets/backlink and widgets/itemPerPage (only used by them). Every moved, merged or removed path is in UPGRADE.md → "Upgrade to 2.8". Comments in renderers and stories (incl. those added by #557) point at the new paths.

Evidence

  • Old paths: grep of every old path over lib src templates config docs → nothing left (outside CHANGELOG / UPGRADE history); every @RoadizRozier/… reference resolves to an existing file.
  • lint:twig: OK on the 5 template folders.
  • Render: a throwaway WebTestCase (not committed) logged in as superadmin and requested every backoffice GET route with fixture entities: 565 URLs, 519 × 200, 42 × 302, no Twig error; login pages render anonymously. The 4 failures are controller-side and unrelated (node-types/decorators/add missing param, 2FA backup codes without 2FA, articles shadow root missing in fixtures ×2). Merged markup present in the HTML (repeatable, dropdown trigger, breadcrumb overflow, bulk actions, filters bar), repeatable item content not double-escaped.
  • PHPUnit: same result as develop in the local env (576 tests, same 5 errors / 3 failures before and after).

Click-through, both themes:

  • Dashboard (panels, nav)
  • Header + color scheme switcher, aside tree, menu bar
  • Node edit: children nodes "add" dropdown, repeatable fields, drawers, geotag, breadcrumb overflow
  • Lists with filters bar, select all, bulk actions (nodes, documents, users, tags)
  • Confirm pages (delete), settings (horizontal forms)
  • Login, login request/reset, login link, 2FA pages

Merge Danger

Door: one-way

Projects that include / embed / extends or override @RoadizRozier/… shared templates break on 2.8; this is the break ADR 0005 accepts, documented in UPGRADE.md. Reverting inside the repo stays easy (moves + path rewrites).

Blast Radius: backoffice-wide

Every backoffice screen goes through moved layouts/components; a missed path is a 500 on render, which the smoke run covered for GET screens (AJAX tree endpoints only checked statically).

Open points, not in this PR:

  • ~30 include of components (filters bar, table actions, drawer, repeatable…) contradict "a component is never pulled in with include" → PR 2.
  • docs/extensions/backoffice_templates.md documents layouts/admin and layouts/head, which makes them public per ADR 0006 while templates.md lists only components/patterns: keep or drop?
  • rz_drawer, rz_geotag open on <rz-form-field>, rz_color_scheme_switcher on <rz-popover>: file names follow the component, not the outer root.
  • Pre-existing: id ~ '_repeatable'|default(...) in rz_repeatable never applies the default.

Timothe Joubert added 2 commits October 30, 2026 15:58
Move layouts to layouts/, layout regions to patterns/ and every rz-*
component to components/, following lib/Rozier/docs/templates.md
(ADR 0005). Merge the duplicated components (dropdown + dropdown menu,
breadcrumb + item, both repeatables, both filters bars, bulk macros
into rz_bulk_actions) and remove the unreferenced templates.

Every moved, merged or removed path is listed in UPGRADE.md
"Upgrade to 2.8".

Refs #540
@timothejoubert
timothejoubert marked this pull request as draft October 30, 2026 15:38
@timothejoubert

Copy link
Copy Markdown
Contributor Author

Change of plan: breaking changes must be avoided as much as possible, including for this template move.

As it stands, this PR breaks every project that includes, embeds, extends or overrides one of the moved @RoadizRozier/… paths. ADR 0005 accepted that break and explicitly rejected keeping deprecated aliases until v3. We need to find a way to land the new tree without breaking projects, and record the rule ("avoid breaking changes as much as possible") in an ADR that supersedes that part of ADR 0005.

On hold until that ADR is written; this PR will then be reworked to follow it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant