diff --git a/UPGRADE.md b/UPGRADE.md index cdb668d8a..2f1c06fdf 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -14,10 +14,70 @@ ## ⚠ Twig breaking changes - Removed bulk confirmation templates (`bulk_base.html.twig`, `bulk_delete.html.twig`), use `admin/confirm_action.html.twig` instead -- Moved `widgets/tree/rz_tree_wrapper_auto.html.twig` to `widgets/rz_tree_wrapper_auto.html.twig`; it now renders node, tag and folder trees alike -- Removed `widgets/rz_tree_wrapper.html.twig`, `widgets/nodeTree/rz_node_tree_wrapper.html.twig`, `widgets/tagTree/rz_tag_tree_wrapper.html.twig` and `widgets/folderTree/rz_folder_tree_wrapper.html.twig`, use `widgets/rz_tree_wrapper_auto.html.twig` instead - -For Twig templates using `@RoadizRozier/admin/base.html.twig` as parent template, make sure to update +- Moved `widgets/tree/rz_tree_wrapper_auto.html.twig` to `components/rz_tree.html.twig`; it now renders node, tag and folder trees alike +- Removed `widgets/rz_tree_wrapper.html.twig`, `widgets/nodeTree/rz_node_tree_wrapper.html.twig`, `widgets/tagTree/rz_tag_tree_wrapper.html.twig` and `widgets/folderTree/rz_folder_tree_wrapper.html.twig`, use `components/rz_tree.html.twig` instead + +### Templates moved to the role-based tree + +Shared templates now live in `layouts/`, `patterns/`, `components/` (one file per `rz-*` element), `form/`, `macros/` and `includes/`. `layout.html.twig`, `forms.html.twig` and `dashboard/index.html.twig` do not move. Update every `include`, `embed`, `import`, `extends` and every override under `templates/bundles/RoadizRozierBundle/`: + +| Old path | New path | +|----------|----------| +| `admin/base.html.twig` | `layouts/admin.html.twig` | +| `base.html.twig` | `layouts/base.html.twig` | +| `admin/head.html.twig` | `layouts/head.html.twig` | +| `login/base.html.twig` | `layouts/login.html.twig` | +| `admin/meta-icon.html.twig` | `layouts/meta_icon.html.twig` | +| `simple.html.twig` | `layouts/simple.html.twig` | +| `widgets/rz_aside.html.twig` | `patterns/aside.html.twig` | +| `dashboard/navBar.html.twig` | `patterns/dashboard_nav.html.twig` | +| `dashboard/panel.html.twig` | `patterns/dashboard_panel.html.twig` | +| `admin/rz_header.html.twig` | `patterns/header.html.twig` | +| `macros/rz_menu_bar.html.twig` | `patterns/menu_bar.html.twig` | +| `macros/rz_actions_menu.html.twig` | `components/rz_actions_menu.html.twig` | +| `macros/rz_badge.html.twig` | `components/rz_badge.html.twig` | +| `includes/rz_breadcrumb_item.html.twig` | `components/rz_breadcrumb.html.twig` (its `item` macro) | +| `macros/rz_breadcrumb.html.twig` | `components/rz_breadcrumb.html.twig` | +| `macros/rz_bulk.html.twig` | `components/rz_bulk_actions.html.twig` | +| `widgets/rz_bulk_actions.html.twig` | `components/rz_bulk_actions.html.twig` | +| `macros/rz_button.html.twig` | `components/rz_button.html.twig` | +| `macros/rz_card.html.twig` | `components/rz_card.html.twig` | +| `includes/rz_color_scheme_switcher.html.twig` | `components/rz_color_scheme_switcher.html.twig` | +| `macros/rz_dialog.html.twig` | `components/rz_dialog.html.twig` | +| `widgets/drawer.html.twig` | `components/rz_drawer.html.twig` | +| `includes/rz_dropdown.html.twig` | `components/rz_dropdown.html.twig` | +| `macros/rz_dropdown_menu.html.twig` | `components/rz_dropdown.html.twig` | +| `macros/rz_filters_bar.html.twig` | `components/rz_filters_bar.html.twig` | +| `widgets/rz_filters_bar.html.twig` | `components/rz_filters_bar.html.twig` | +| `macros/rz_form_field.html.twig` | `components/rz_form_field.html.twig` | +| `widgets/rz_geotag_field.html.twig` | `components/rz_geotag.html.twig` | +| `macros/rz_header.html.twig` | `components/rz_header_nav_item.html.twig` | +| `widgets/rz_language_switcher.html.twig` | `components/rz_language_switcher.html.twig` | +| `macros/rz_link.html.twig` | `components/rz_link.html.twig` | +| `macros/rz_node_badge.html.twig` | `components/rz_node_badge.html.twig` | +| `macros/rz_overflow_list.html.twig` | `components/rz_overflow_list.html.twig` | +| `macros/rz_page_header.html.twig` | `components/rz_page_header.html.twig` | +| `macros/rz_progress.html.twig` | `components/rz_progress.html.twig` | +| `widgets/rz_repeatable.html.twig` | `components/rz_repeatable.html.twig` | +| `macros/rz_repeatable.html.twig` (embedded, `inner_body` block) | `components/rz_repeatable.html.twig` (`item(options)` macro, `content` option) | +| `includes/rz_table.html.twig` | `components/rz_table.html.twig` | +| `includes/rz_table_actions.html.twig` | `components/rz_table_actions.html.twig` | +| `widgets/rz_tree_wrapper_auto.html.twig` | `components/rz_tree.html.twig` | +| `widgets/rz_tree_item_inner.html.twig` | `components/rz_tree_item.html.twig` | +| `widgets/documentAlignment.html.twig` | `form/document_alignment.html.twig` | +| `horizontalForms.html.twig` | `form/horizontal_forms.html.twig` | +| `includes/rz_meta_item_table.html.twig` | `includes/meta_item_table.html.twig` | +| `includes/translateAssistantUsage.html.twig` | `includes/translate_assistant_usage.html.twig` | + +Merged templates: + +- `includes/rz_dropdown.html.twig` (popover + trigger) and `macros/rz_dropdown_menu.html.twig` (menu) are one embed: pass `target_options` to `components/rz_dropdown.html.twig` to get the trigger, `targetId` instead of `id`, and `popover_attributes` instead of the popover `attributes`. Drop the nested `popover` block, override `items` directly. +- The `rz_bulk` macros (`select_input`, `select_all_input`, `select_all_button`, `deselect_all_button`) are imported from `components/rz_bulk_actions.html.twig`. +- The `rz_filters_bar` macros are part of `components/rz_filters_bar.html.twig`. + +Removed templates, unused by the backoffice: `admin/blocks/adminImage.html.twig`, `admin/blocks/loginImage.html.twig`, `custom-form-fields/ajaxEditBase.html.twig`, `documents/backLink.html.twig`, `documents/itemPerPage.html.twig`, `login/check.html.twig`, `nodes/redirection_table.html.twig`, `nodes/widgets/node-header.html.twig`, `tags/navBack.html.twig`, `widgets/backlink.html.twig`, `widgets/countFiltersBar.html.twig`, `widgets/itemPerPage.html.twig`, `widgets/versionItem.html.twig`. + +For Twig templates using `@RoadizRozier/layouts/admin.html.twig` as parent template, make sure to update - `content_title` - `content_count_filters` - `content_header_nav` @@ -27,7 +87,7 @@ blocks to use new `header` block instead. Example: ```twig {%- block header -%} - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: 'my_entities'|trans, filters: filters, buttons: [ @@ -41,11 +101,11 @@ Example: {%- endblock -%} ``` -You need to update your `content_filters` block to use new `widgets/rz_filters_bar.html.twig` inside this block. +You need to update your `content_filters` block to use new `components/rz_filters_bar.html.twig` inside this block. Example: ```twig -{% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { +{% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, } only %} @@ -211,13 +271,13 @@ These classes are no longer `Throwable` in ORM 3. Remove any `@throws` PHPDoc an ## ⚠ Rozier session and health check dialogs The session expiration and health check warning modals no longer use Vue: they are plain -`` elements rendered in `@RoadizRozier/base.html.twig` by the new -`@RoadizRozier/macros/rz_dialog.html.twig` component and opened by `LoginCheckService`. The session expired dialog no longer shows the splash screen image. +`` elements rendered in `@RoadizRozier/layouts/base.html.twig` by the new +`@RoadizRozier/components/rz_dialog.html.twig` component and opened by `LoginCheckService`. The session expired dialog no longer shows the splash screen image. Removed from the Rozier front-end: - `app/components/WarningModal.vue` and `app/containers/ModalContainer.vue`, the `` - element in `base.html.twig`, and the `vue-js-modal` dependency + element in `layouts/base.html.twig`, and the `vue-js-modal` dependency - `app/api/SplashScreenApi.js` and its `getImage()` function - `connected` and `healthChecked` Vuex state, and the `LOGIN_CHECK_*` / `HEALTH_CHECK_*` mutation types - `sessionExpireTitle`, `sessionExpireContent`, `healthCheckedFailedTitle` and @@ -226,7 +286,7 @@ Removed from the Rozier front-end: Overriding those messages from JavaScript no longer has any effect. Override the `session.expire.title`, `session.expire.content`, `health_check.failed.title` and `health_check.failed.content` translation keys in your project catalogue instead, or override -`templates/bundles/RoadizRozierBundle/macros/rz_dialog.html.twig` to change the markup. +`templates/bundles/RoadizRozierBundle/components/rz_dialog.html.twig` to change the markup. ## ⚠ Rozier dead Vue containers and components removed @@ -239,16 +299,16 @@ now renders ``), and are removed: - the `vue-multiselect` dependency If a project template still renders `` (copied from the v2.7 -`widgets/drawer.html.twig`) or ``, it renders nothing anymore: migrate it to -``, as `@RoadizRozier/widgets/drawer.html.twig` does. +`components/rz_drawer.html.twig`) or ``, it renders nothing anymore: migrate it to +``, as `@RoadizRozier/components/rz_drawer.html.twig` does. ## New admin templates New reusable templates for building back-office pages: -- `admin/head.html.twig` - Page header with title, breadcrumb, buttons +- `layouts/head.html.twig` - Page header with title, breadcrumb, buttons - `admin/confirm_action.html.twig` - Generic confirmation page -- `macros/rz_breadcrumb.html.twig` - Breadcrumb trail. Fed by a `breadcrumb` variable - `{ parents, current }`, rendered automatically by `admin/head.html.twig` as soon as that +- `components/rz_breadcrumb.html.twig` - Breadcrumb trail. Fed by a `breadcrumb` variable + `{ parents, current }`, rendered automatically by `layouts/head.html.twig` as soon as that variable is in context. Ancestors are either `{label, url}` hashes or entities resolved by a `BreadcrumbsItemFactory`; past three of them the middle ones fold into a popover. - `breadcrumb_root('
')` Twig function, backed by the `BreadcrumbRoots` service - the single @@ -258,8 +318,8 @@ New reusable templates for building back-office pages: tree entity — root, ancestors, then the item — which confirmation pages show above their own title. It covers the sections Rozier ships; a project's own section writes its root inline. See `docs/developer/contributing/contributing.md` and `docs/extensions/custom_backoffice_entry.md`. -- `widgets/rz_filters_bar.html.twig` - Filter bar widget -- `widgets/rz_bulk_actions.html.twig` - Bulk actions widget +- `components/rz_filters_bar.html.twig` - Filter bar widget +- `components/rz_bulk_actions.html.twig` - Bulk actions widget - New macros: `rz_button`, `rz_badge`, `rz_actions_menu`, `rz_card` # Upgrade to 2.7 diff --git a/docs/developer/contributing/contributing.md b/docs/developer/contributing/contributing.md index 37fcaab73..0e73b6f2b 100644 --- a/docs/developer/contributing/contributing.md +++ b/docs/developer/contributing/contributing.md @@ -59,7 +59,7 @@ and do not rename them opportunistically either: a template variable is a public is a breaking change that belongs in a major release and in `UPGRADE.md`. Finally, document the options a template expects in a `{# Variables: #}` comment at the top of the -file, the way `admin/head.html.twig` does. It is the only place a caller can discover them. +file, the way `layouts/head.html.twig` does. It is the only place a caller can discover them. ## Building a back-office breadcrumb diff --git a/docs/extensions/additional_entries_navbar.md b/docs/extensions/additional_entries_navbar.md index bfc4324ce..ed1b2a35f 100644 --- a/docs/extensions/additional_entries_navbar.md +++ b/docs/extensions/additional_entries_navbar.md @@ -21,7 +21,7 @@ Here is how to add a button. You simply need to change the template you extend ( {% extends "@!RoadizRozier/users/navBar.html.twig" %} {# 2. Import the macro #} -{% import "@!RoadizRozier/macros/rz_menu_bar.html.twig" as rz_menu_bar %} +{% import "@!RoadizRozier/patterns/menu_bar.html.twig" as rz_menu_bar %} {# 3. Add your content #} {% block additional_entries %} @@ -79,7 +79,7 @@ You can replace a default button with your own implementation: ```twig {% extends "@RoadizRozier/nodes/navBar.html.twig" %} -{% import "@!RoadizRozier/macros/rz_menu_bar.html.twig" as rz_menu_bar %} +{% import "@!RoadizRozier/patterns/menu_bar.html.twig" as rz_menu_bar %} {# Overrides the SEO button display #} {% block node_seo %} diff --git a/docs/extensions/backoffice_extension_points.md b/docs/extensions/backoffice_extension_points.md index 080cfde95..a26b91cfc 100644 --- a/docs/extensions/backoffice_extension_points.md +++ b/docs/extensions/backoffice_extension_points.md @@ -113,7 +113,7 @@ services: {%- block dashboard_panels -%}
- {% embed '@RoadizRozier/dashboard/panel.html.twig' with { + {% embed '@RoadizRozier/patterns/dashboard_panel.html.twig' with { icon: 'rz-icon-ri--computer-line', title: 'My latest articles'|trans, } %} diff --git a/docs/extensions/backoffice_templates.md b/docs/extensions/backoffice_templates.md index 33b9338b3..731adab04 100644 --- a/docs/extensions/backoffice_templates.md +++ b/docs/extensions/backoffice_templates.md @@ -15,7 +15,7 @@ The template system is organized into several layers: ## Generic Admin Templates -### `admin/base.html.twig` +### `layouts/admin.html.twig` The base layout for listing pages. Extends `@RoadizRozier/layout.html.twig` and provides a structured content area with bulk selection support. @@ -30,10 +30,10 @@ The base layout for listing pages. Extends `@RoadizRozier/layout.html.twig` and **Example usage:** ```twig -{% extends "@RoadizRozier/admin/base.html.twig" %} +{% extends "@RoadizRozier/layouts/admin.html.twig" %} {%- block header -%} - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: 'my_entities'|trans, filters: filters, buttons: [{ @@ -45,7 +45,7 @@ The base layout for listing pages. Extends `@RoadizRozier/layout.html.twig` and {%- endblock -%} {%- block content_filters -%} - {% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { + {% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, } only %} @@ -58,7 +58,7 @@ The base layout for listing pages. Extends `@RoadizRozier/layout.html.twig` and {%- endblock -%} ``` -### `admin/head.html.twig` +### `layouts/head.html.twig` A generic and reusable header template for admin pages. It handles page titles, breadcrumbs, action buttons, item counts, and translation switching. @@ -111,7 +111,7 @@ A generic and reusable header template for admin pages. It handles page titles, **Full example:** ```twig -{% include '@RoadizRozier/admin/head.html.twig' with { +{% include '@RoadizRozier/layouts/head.html.twig' with { title: 'edit.article'|trans ~ ' "' ~ item.title ~ '"', filters: filters, buttons: [ @@ -306,18 +306,18 @@ Items are rendered using the `rz_card.html.twig` macro which supports three thum {% endif %} ``` -## Macros System +## Components -Macros are reusable Twig components for rendering UI elements consistently. +Components live in `components/`, one file per `rz-*` element. Leaf components are macros you import; the ones with content slots are templates you embed. -### `rz_button.html.twig` +### `components/rz_button.html.twig` Renders buttons and button-like links. **Import and usage:** ```twig -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {# Basic submit button #} {{ rz_button.root({ @@ -356,12 +356,12 @@ Renders buttons and button-like links. | `attributes` | object | HTML attributes (`href`, `type`, `title`, etc.) | | `tagName` | string | HTML tag (default: `button`, auto `a` if `href`) | -### `rz_badge.html.twig` +### `components/rz_badge.html.twig` Renders badges for status indicators, counts, or labels. ```twig -{% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %} +{% import "@RoadizRozier/components/rz_badge.html.twig" as rz_badge %} {{ rz_badge.item({ label: 'published', @@ -387,12 +387,12 @@ Renders badges for status indicators, counts, or labels. | `color` | string | `success`, `danger`, `warning`, `default` | | `attributes` | object | HTML attributes (use `href` for link badge) | -### `rz_actions_menu.html.twig` +### `components/rz_actions_menu.html.twig` An embeddable template for action menus (typically positioned on the side of edit pages). ```twig -{% embed "@RoadizRozier/macros/rz_actions_menu.html.twig" with { +{% embed "@RoadizRozier/components/rz_actions_menu.html.twig" with { vertical: true, class: 'actions-menu', } only %} @@ -411,12 +411,12 @@ An embeddable template for action menus (typically positioned on the side of edi | `deleteItem(label, href, attr)` | Delete button/link | | `item(label, class, href, icon, attr)` | Generic action item | -### `rz_dropdown_menu.html.twig` +### `components/rz_dropdown.html.twig` Creates dropdown menus with customizable items. ```twig -{% embed "@RoadizRozier/macros/rz_dropdown_menu.html.twig" with { +{% embed "@RoadizRozier/components/rz_dropdown.html.twig" with { targetId: 'my-dropdown', title: 'actions'|trans, } %} @@ -447,12 +447,14 @@ Creates dropdown menus with customizable items. | `badgeLabel` | string | Badge text | | `selected` | bool | Highlight as selected | -### `rz_link.html.twig` +Pass `target_options` (the options of the `rz_button` that opens it) and the menu comes with its own trigger, wrapped in an ``; `placement`, `offset`, `shift` and `popover_attributes` tune the popover. Without `target_options`, render the trigger yourself and point it at `targetId`. + +### `components/rz_link.html.twig` Simple link component. ```twig -{% import '@RoadizRozier/macros/rz_link.html.twig' as rz_link %} +{% import '@RoadizRozier/components/rz_link.html.twig' as rz_link %} {{ rz_link.root({ label: 'see.details', @@ -461,28 +463,28 @@ Simple link component. }) }} ``` -### `rz_bulk.html.twig` +### Bulk selection inputs (`components/rz_bulk_actions.html.twig`) Utilities for bulk selection in tables. ```twig -{% import '@RoadizRozier/macros/rz_bulk.html.twig' as rz_bulk %} +{% import '@RoadizRozier/components/rz_bulk_actions.html.twig' as rz_bulk_actions %} {# In table header #} -{{ rz_bulk.select_all_input() }} +{{ rz_bulk_actions.select_all_input() }} {# In table row #} -{{ rz_bulk.select_input({ value: item.id }) }} +{{ rz_bulk_actions.select_input({ value: item.id }) }} ``` ## Reusable Widgets -### `widgets/rz_filters_bar.html.twig` +### `components/rz_filters_bar.html.twig` Complete filter bar with search, pagination, and bulk selection controls. ```twig -{% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { +{% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, display_layout_fields: false, @@ -492,7 +494,7 @@ Complete filter bar with search, pagination, and bulk selection controls. **With custom filters using embed:** ```twig -{% embed "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { +{% embed "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, } only %} @@ -515,13 +517,13 @@ Complete filter bar with search, pagination, and bulk selection controls. | `display_layout_fields` | bool | Show grid/list toggle | | `with_filter_form` | bool | Enable search form (default: true) | -### `widgets/rz_bulk_actions.html.twig` +### `components/rz_bulk_actions.html.twig` Floating action bar that appears when items are selected. ```twig -{% embed "@RoadizRozier/widgets/rz_bulk_actions.html.twig" %} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% embed "@RoadizRozier/components/rz_bulk_actions.html.twig" %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% block other_actions %} {{ rz_button.root({ @@ -555,12 +557,12 @@ For standard bulk actions (publish, unpublish, delete), use the pre-built `@Road This requires `hasBulkActions`, `bulkPublishForm`, `bulkUnpublishForm`, and `bulkDeleteForm` variables from your controller. ::: -### `includes/rz_table.html.twig` +### `components/rz_table.html.twig` Embeddable table component with sorting, selection, and action columns. ```twig -{% embed '@RoadizRozier/includes/rz_table.html.twig' with { +{% embed '@RoadizRozier/components/rz_table.html.twig' with { selection_available: true, actions_available: true, items: items, @@ -576,19 +578,19 @@ Embeddable table component with sorting, selection, and action columns. {% if selection_available %} - {% import '@RoadizRozier/macros/rz_bulk.html.twig' as rz_bulk %} - {{ rz_bulk.select_input({ value: item.id }) }} + {% import '@RoadizRozier/components/rz_bulk_actions.html.twig' as rz_bulk_actions %} + {{ rz_bulk_actions.select_input({ value: item.id }) }} {% endif %} {{ item.title }} {{ item.createdAt|format_datetime('short', 'short') }} - {% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %} + {% import "@RoadizRozier/components/rz_badge.html.twig" as rz_badge %} {{ rz_badge.item({ label: item.status }) }} {% if actions_available %} - {% include '@RoadizRozier/includes/rz_table_actions.html.twig' with { + {% include '@RoadizRozier/components/rz_table_actions.html.twig' with { edit_href: path('entity_edit', { id: item.id }), delete_href: path('entity_delete', { id: item.id }), } %} @@ -614,12 +616,12 @@ Embeddable table component with sorting, selection, and action columns. | `sortable.enabled` | bool | Enable drag-and-drop sorting | | `sortable.url` | string | URL for sort updates | -### `includes/rz_table_actions.html.twig` +### `components/rz_table_actions.html.twig` Row action buttons (edit, delete, custom). ```twig -{% embed '@RoadizRozier/includes/rz_table_actions.html.twig' with { +{% embed '@RoadizRozier/components/rz_table_actions.html.twig' with { edit_href: path('entity_edit', { id: item.id }), delete_href: path('entity_delete', { id: item.id }), } %} @@ -647,7 +649,7 @@ Understanding when to use `{% include %}` versus `{% embed %}` is essential for ```twig {# Simple inclusion with variables #} -{% include '@RoadizRozier/admin/head.html.twig' with { +{% include '@RoadizRozier/layouts/head.html.twig' with { title: 'My Page', buttons: [...] } only %} @@ -661,7 +663,7 @@ Understanding when to use `{% include %}` versus `{% embed %}` is essential for ```twig {# Embedding with block customization #} -{% embed "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { +{% embed "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, } only %} {% block before_submit %} @@ -707,10 +709,10 @@ Use the `@!` prefix to extend the original template while adding customizations: ```twig {# templates/bundles/RoadizRozierBundle/dashboard/index.html.twig #} {% extends "@!RoadizRozier/dashboard/index.html.twig" %} -{% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %} +{% import '@RoadizRozier/components/rz_button.html.twig' as rz_button %} {%- block header -%} - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: "hello.%name%"|trans({'%name%': displayName}), breadcrumb: { label: 'breadcrumb', @@ -730,7 +732,7 @@ Use the `@!` prefix to extend the original template while adding customizations: {{ parent() }} {# Add custom panel #} - {% embed '@RoadizRozier/dashboard/panel.html.twig' with { + {% embed '@RoadizRozier/patterns/dashboard_panel.html.twig' with { icon: 'rz-icon-ri--bar-chart-line', title: 'my.custom.stats'|trans, } %} @@ -747,7 +749,7 @@ For complete replacement without inheritance: ```twig {# templates/bundles/RoadizRozierBundle/redirections/list.html.twig #} -{% extends '@RoadizRozier/admin/base.html.twig' %} +{% extends '@RoadizRozier/layouts/admin.html.twig' %} {# Completely custom implementation #} {%- block header -%} @@ -796,10 +798,10 @@ Here's a complete example of a custom listing page: ```twig {# templates/admin/product/list.html.twig #} -{% extends "@RoadizRozier/admin/base.html.twig" %} +{% extends "@RoadizRozier/layouts/admin.html.twig" %} {%- block header -%} - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: 'products'|trans, filters: filters, buttons: [{ @@ -815,7 +817,7 @@ Here's a complete example of a custom listing page: {%- endblock -%} {%- block content_filters -%} - {% embed "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { + {% embed "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: hasBulkActions, } only %} @@ -836,7 +838,7 @@ Here's a complete example of a custom listing page: {%- block content_body -%}
- {% embed '@RoadizRozier/includes/rz_table.html.twig' with { + {% embed '@RoadizRozier/components/rz_table.html.twig' with { selection_available: hasBulkActions, actions_available: true, items: products, @@ -852,8 +854,8 @@ Here's a complete example of a custom listing page: {% if selection_available %} - {% import '@RoadizRozier/macros/rz_bulk.html.twig' as rz_bulk %} - {{ rz_bulk.select_input({ value: product.id }) }} + {% import '@RoadizRozier/components/rz_bulk_actions.html.twig' as rz_bulk_actions %} + {{ rz_bulk_actions.select_input({ value: product.id }) }} {% endif %} @@ -863,7 +865,7 @@ Here's a complete example of a custom listing page: {{ product.price|format_currency('EUR') }} - {% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %} + {% import "@RoadizRozier/components/rz_badge.html.twig" as rz_badge %} {{ rz_badge.item({ label: product.status, color: product.isPublished ? 'success' : 'warning', @@ -871,7 +873,7 @@ Here's a complete example of a custom listing page: {% if actions_available %} - {% include '@RoadizRozier/includes/rz_table_actions.html.twig' with { + {% include '@RoadizRozier/components/rz_table_actions.html.twig' with { edit_href: path('product_edit', { id: product.id }), delete_href: path('product_delete', { id: product.id }), } %} diff --git a/docs/extensions/custom_backoffice_entry.md b/docs/extensions/custom_backoffice_entry.md index 2604b2961..ea08b908f 100644 --- a/docs/extensions/custom_backoffice_entry.md +++ b/docs/extensions/custom_backoffice_entry.md @@ -387,13 +387,13 @@ instead of retyping it: ```twig {# templates/admin/article/list.html.twig #} -{% include '@RoadizRozier/admin/head.html.twig' with { +{% include '@RoadizRozier/layouts/head.html.twig' with { title: 'articles'|trans, breadcrumb: { current: 'articles'|trans }, } only %} {# templates/admin/article/add.html.twig #} -{% include '@RoadizRozier/admin/head.html.twig' with { +{% include '@RoadizRozier/layouts/head.html.twig' with { title: 'articles.add'|trans, breadcrumb: { parents: [breadcrumb_root('articles')], diff --git a/lib/RoadizCoreBundle/templates/customForm/base_custom_form.html.twig b/lib/RoadizCoreBundle/templates/customForm/base_custom_form.html.twig index 93161ef93..34cd23347 100644 --- a/lib/RoadizCoreBundle/templates/customForm/base_custom_form.html.twig +++ b/lib/RoadizCoreBundle/templates/customForm/base_custom_form.html.twig @@ -7,7 +7,7 @@ {% block title %}{{ meta.siteName }}{% endblock %} - {% include '@RoadizRozier/admin/meta-icon.html.twig' %} + {% include '@RoadizRozier/layouts/meta_icon.html.twig' %} {# CSS scripts inclusions / Using webpack #} {{ manifest_preload_tags('shared') }} {{ manifest_preload_tags('simple') }} diff --git a/lib/RoadizRozierBundle/src/Controller/AbstractAdminWithBulkController.php b/lib/RoadizRozierBundle/src/Controller/AbstractAdminWithBulkController.php index a8b12a8c1..a4e1f10df 100644 --- a/lib/RoadizRozierBundle/src/Controller/AbstractAdminWithBulkController.php +++ b/lib/RoadizRozierBundle/src/Controller/AbstractAdminWithBulkController.php @@ -208,7 +208,7 @@ protected function bulkAction( $this->assignation[$bulkFormName] = $bulkForm->createView(); $this->assignation['title'] = $templateOptions['title'] ?? $this->translator->trans('delete.bulk.'.$this->getNamespace()); - $this->assignation['headPath'] = $templateOptions['headPath'] ?? '@RoadizRozier/admin/head.html.twig'; + $this->assignation['headPath'] = $templateOptions['headPath'] ?? '@RoadizRozier/layouts/head.html.twig'; $this->assignation['cancelPath'] = $templateOptions['cancelPath'] ?? $this->generateUrl($this->getDefaultRouteName(), $this->getDefaultRouteParameters()); $this->assignation['alertMessage'] = $templateOptions['alertMessage'] ?? $this->translator->trans( 'are_you_sure.delete.these.%namespace%', diff --git a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxFolderTreeController.php b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxFolderTreeController.php index 6efbb2f84..7d6d5d404 100644 --- a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxFolderTreeController.php +++ b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxFolderTreeController.php @@ -71,7 +71,7 @@ public function getTreeAction(Request $request): JsonResponse 'statusCode' => '200', 'status' => 'success', 'tree_type' => $assignation['tree_type'], - 'folderTree' => $this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation), + 'folderTree' => $this->twig->render('@RoadizRozier/components/rz_tree.html.twig', $assignation), ]); } } diff --git a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxNodeTreeController.php b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxNodeTreeController.php index ff543f4db..0dc088c2f 100644 --- a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxNodeTreeController.php +++ b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxNodeTreeController.php @@ -124,7 +124,7 @@ public function getTreeAction(Request $request): JsonResponse 'status' => 'success', 'tree_type' => $assignation['tree_type'], 'linkedTypes' => $linkedTypes, - 'nodeTree' => trim($this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation)), + 'nodeTree' => trim($this->twig->render('@RoadizRozier/components/rz_tree.html.twig', $assignation)), ]); } } diff --git a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxTagTreeController.php b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxTagTreeController.php index 6043bbe57..019dc4058 100644 --- a/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxTagTreeController.php +++ b/lib/RoadizRozierBundle/src/Controller/Ajax/Tree/AjaxTagTreeController.php @@ -78,7 +78,7 @@ public function getTreeAction(Request $request): JsonResponse 'statusCode' => '200', 'status' => 'success', 'tree_type' => $assignation['tree_type'], - 'tagTree' => $this->twig->render('@RoadizRozier/widgets/rz_tree_wrapper_auto.html.twig', $assignation), + 'tagTree' => $this->twig->render('@RoadizRozier/components/rz_tree.html.twig', $assignation), ]); } } diff --git a/lib/RoadizRozierBundle/src/Controller/SettingController.php b/lib/RoadizRozierBundle/src/Controller/SettingController.php index d8adfea87..422ce0d3a 100644 --- a/lib/RoadizRozierBundle/src/Controller/SettingController.php +++ b/lib/RoadizRozierBundle/src/Controller/SettingController.php @@ -339,7 +339,7 @@ public function deleteAction(Request $request, int $settingId): Response return $this->render('@RoadizRozier/admin/confirm_action.html.twig', [ 'title' => $title, - 'headPath' => '@RoadizRozier/admin/head.html.twig', + 'headPath' => '@RoadizRozier/layouts/head.html.twig', 'breadcrumb_parents' => [ $this->breadcrumbRoots->get('settings'), [ diff --git a/lib/RoadizRozierBundle/src/Controller/Tag/TagController.php b/lib/RoadizRozierBundle/src/Controller/Tag/TagController.php index 3a7622105..0839b7613 100644 --- a/lib/RoadizRozierBundle/src/Controller/Tag/TagController.php +++ b/lib/RoadizRozierBundle/src/Controller/Tag/TagController.php @@ -308,7 +308,7 @@ public function bulkDeleteAction(Request $request): Response return $this->render('@RoadizRozier/admin/confirm_action.html.twig', [ 'title' => $title, - 'headPath' => '@RoadizRozier/admin/head.html.twig', + 'headPath' => '@RoadizRozier/layouts/head.html.twig', 'cancelPath' => $assignation['referer'] ?? $this->generateUrl('tagsHomePage'), 'breadcrumb_parents' => [$this->breadcrumbRoots->get('tags')], 'alertMessage' => 'are_you_sure.delete.these.tags', diff --git a/lib/RoadizRozierBundle/src/Controller/TranslationController.php b/lib/RoadizRozierBundle/src/Controller/TranslationController.php index e54e7f34f..249106f76 100644 --- a/lib/RoadizRozierBundle/src/Controller/TranslationController.php +++ b/lib/RoadizRozierBundle/src/Controller/TranslationController.php @@ -194,7 +194,7 @@ public function deleteAction(Request $request, int $translationId): Response return $this->render('@RoadizRozier/admin/confirm_action.html.twig', [ 'title' => $title, - 'headPath' => '@RoadizRozier/admin/head.html.twig', + 'headPath' => '@RoadizRozier/layouts/head.html.twig', 'cancelPath' => $this->generateUrl('translationsHomePage'), 'breadcrumb_parents' => [ $this->breadcrumbRoots->get('translations'), diff --git a/lib/RoadizRozierBundle/src/Controller/User/UserRoleController.php b/lib/RoadizRozierBundle/src/Controller/User/UserRoleController.php index 45f6afaed..9a993c62f 100644 --- a/lib/RoadizRozierBundle/src/Controller/User/UserRoleController.php +++ b/lib/RoadizRozierBundle/src/Controller/User/UserRoleController.php @@ -116,7 +116,7 @@ public function removeRoleAction(Request $request, int $userId, string $role): R '%name%' => $user->getUserName(), '%role%' => $role, ]), - 'headPath' => '@RoadizRozier/admin/head.html.twig', + 'headPath' => '@RoadizRozier/layouts/head.html.twig', 'breadcrumb_parents' => [ $this->breadcrumbRoots->get('users'), [ diff --git a/lib/RoadizRozierBundle/templates/admin/blocks/adminImage.html.twig b/lib/RoadizRozierBundle/templates/admin/blocks/adminImage.html.twig deleted file mode 100644 index 76546b8c7..000000000 --- a/lib/RoadizRozierBundle/templates/admin/blocks/adminImage.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -
- {% if project_logo_url is not empty %} - - {% else %} - - {% endif %} -
diff --git a/lib/RoadizRozierBundle/templates/admin/blocks/loginImage.html.twig b/lib/RoadizRozierBundle/templates/admin/blocks/loginImage.html.twig deleted file mode 100644 index 4bcfafcb6..000000000 --- a/lib/RoadizRozierBundle/templates/admin/blocks/loginImage.html.twig +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/lib/RoadizRozierBundle/templates/admin/bulk_actions.html.twig b/lib/RoadizRozierBundle/templates/admin/bulk_actions.html.twig index fa7fb1565..402165dd3 100644 --- a/lib/RoadizRozierBundle/templates/admin/bulk_actions.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/bulk_actions.html.twig @@ -1,6 +1,6 @@ {% if hasBulkActions %} - {% embed "@RoadizRozier/widgets/rz_bulk_actions.html.twig" %} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} + {% embed "@RoadizRozier/components/rz_bulk_actions.html.twig" %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% block other_actions %} {% if bulkPublishForm %} {% form_theme bulkPublishForm '@RoadizRozier/forms.html.twig' %} diff --git a/lib/RoadizRozierBundle/templates/admin/confirm_action.html.twig b/lib/RoadizRozierBundle/templates/admin/confirm_action.html.twig index 6c6ce0b29..dae5a69f9 100644 --- a/lib/RoadizRozierBundle/templates/admin/confirm_action.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/confirm_action.html.twig @@ -5,7 +5,7 @@ - title (required): page title, also the last breadcrumb entry - subtitle (optional): line under the title - form (required): the confirmation form - - headPath (required): head template to include, e.g. '@RoadizRozier/admin/head.html.twig' + - headPath (required): head template to include, e.g. '@RoadizRozier/layouts/head.html.twig' - cancelPath (required): URL of the cancel button - alertMessage (required): translation key of the warning shown above the buttons - messageType (optional): rz-message modifier, defaults to 'error' @@ -13,14 +13,14 @@ - thumbnailFormat (optional): format passed to the item cards Template options (snake_case): - - breadcrumb_parents (optional): breadcrumb ancestors, see macros/rz_breadcrumb.html.twig + - breadcrumb_parents (optional): breadcrumb ancestors, see components/rz_breadcrumb.html.twig - action_label / action_icon / action_color (optional): submit button, defaults to a red "delete" Note: the camelCase parameters above predate the naming rule documented in docs/developer/contributing/contributing.md. Renaming them is a breaking change. #} {% extends '@RoadizRozier/layout.html.twig' %} -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% block title %}{{ title|truncate_title }}{% endblock %} @@ -77,7 +77,7 @@ {{ form_end(form) }} {% if items is defined and items|length > 0 %} - {% import '@RoadizRozier/macros/rz_card.html.twig' as card %} + {% import '@RoadizRozier/components/rz_card.html.twig' as card %}
    {% for item in items %} diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/actionsMenu.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/actionsMenu.html.twig index dce6a889f..be59b8523 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/actionsMenu.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/actionsMenu.html.twig @@ -1,4 +1,4 @@ -{% embed "@RoadizRozier/macros/rz_actions_menu.html.twig" with { +{% embed "@RoadizRozier/components/rz_actions_menu.html.twig" with { vertical: true, class: 'actions-menu', item: item diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/add.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/add.html.twig index a3f8377a2..252f31626 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/add.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/add.html.twig @@ -5,7 +5,7 @@ {% block content %}
    - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: title, breadcrumb: { parents: [breadcrumb_root('webhooks')], @@ -17,7 +17,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, { attr: { id: "add-webhook-form" }}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#add-webhook-form') }} {{ form_end(form) }}
diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/delete.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/delete.html.twig index f6a2b073f..4fcac5e09 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/delete.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/delete.html.twig @@ -1,6 +1,6 @@ {% include '@RoadizRozier/admin/confirm_action.html.twig' with { 'title': "delete.webhook.%name%"|trans({'%name%': item.getName()}), - 'headPath': '@RoadizRozier/admin/head.html.twig', + 'headPath': '@RoadizRozier/layouts/head.html.twig', 'breadcrumb_parents': [ breadcrumb_root('webhooks'), { diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/edit.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/edit.html.twig index a46dc8240..d7d8aa70c 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/edit.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/edit.html.twig @@ -4,7 +4,7 @@ {% block content %}
- {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: "edit.webhook.%name%"|trans({'%name%': item}), breadcrumb: { parents: [breadcrumb_root('webhooks')], @@ -16,7 +16,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, { attr: { id: "edit-webhook-form" }}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#edit-webhook-form') }} {{ form_end(form) }} diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/list.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/list.html.twig index d5b17fe8e..4a7ca6695 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/list.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/list.html.twig @@ -4,7 +4,7 @@ {% block content %} - {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: 'webhooks'|trans, filters: filters, buttons: [{ @@ -19,7 +19,7 @@ }, } only %} - {% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { + {% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, } only %} diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/list_table.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/list_table.html.twig index 40a9088e6..32aecaaae 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/list_table.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/list_table.html.twig @@ -1,4 +1,4 @@ -{% embed '@RoadizRozier/includes/rz_table.html.twig' %} +{% embed '@RoadizRozier/components/rz_table.html.twig' %} {% block thead_cells %} {% trans %}webhooks.description{% endtrans %} @@ -33,8 +33,8 @@ {% if selection_available %} - {% import '@RoadizRozier/macros/rz_bulk.html.twig' as rz_bulk %} - {{ rz_bulk.select_input({ value: item.id }) }} + {% import '@RoadizRozier/components/rz_bulk_actions.html.twig' as rz_bulk_actions %} + {{ rz_bulk_actions.select_input({ value: item.id }) }} {% endif %} {{- item.description|centralTruncate(30) -}} @@ -55,7 +55,7 @@ {{- item.lastTriggeredAt ? item.lastTriggeredAt|format_datetime(locale=app.request.locale) : 'never'|trans -}} {% if actions_available %} - {% embed '@RoadizRozier/includes/rz_table_actions.html.twig' with { + {% embed '@RoadizRozier/components/rz_table_actions.html.twig' with { 'edit_href': path('webhooksEditPage', { id: item.id }), 'delete_href': path('webhooksDeletePage', { id: item.id }), } %} diff --git a/lib/RoadizRozierBundle/templates/admin/webhooks/trigger.html.twig b/lib/RoadizRozierBundle/templates/admin/webhooks/trigger.html.twig index d37652d5d..389fb8105 100644 --- a/lib/RoadizRozierBundle/templates/admin/webhooks/trigger.html.twig +++ b/lib/RoadizRozierBundle/templates/admin/webhooks/trigger.html.twig @@ -1,5 +1,5 @@ {% extends '@RoadizRozier/layout.html.twig' %} -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% set title = "trigger.webhook.%name%"|trans({'%name%': item}) %} @@ -7,7 +7,7 @@ {% block content %}
- {% include '@RoadizRozier/admin/head.html.twig' with { + {% include '@RoadizRozier/layouts/head.html.twig' with { title: title, breadcrumb: { parents: [breadcrumb_root('webhooks'), { diff --git a/lib/RoadizRozierBundle/templates/attributes/actionsMenu.html.twig b/lib/RoadizRozierBundle/templates/attributes/actionsMenu.html.twig index e35d7a780..77b13f5db 100644 --- a/lib/RoadizRozierBundle/templates/attributes/actionsMenu.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/actionsMenu.html.twig @@ -1,4 +1,4 @@ -{% embed "@RoadizRozier/macros/rz_actions_menu.html.twig" with { +{% embed "@RoadizRozier/components/rz_actions_menu.html.twig" with { vertical: true, class: 'actions-menu', item: item diff --git a/lib/RoadizRozierBundle/templates/attributes/add.html.twig b/lib/RoadizRozierBundle/templates/attributes/add.html.twig index c881edccc..7ae50f617 100644 --- a/lib/RoadizRozierBundle/templates/attributes/add.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/add.html.twig @@ -12,7 +12,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, { attr: { id: 'add-attribute-form'}}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#add-attribute-form') }} {{ form_end(form) }} diff --git a/lib/RoadizRozierBundle/templates/attributes/edit.html.twig b/lib/RoadizRozierBundle/templates/attributes/edit.html.twig index 2b17d85a8..af07d2022 100644 --- a/lib/RoadizRozierBundle/templates/attributes/edit.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/edit.html.twig @@ -12,7 +12,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, {attr:{id: 'edit-attribute-form'}}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#edit-attribute-form') }} {{ form_end(form) }} diff --git a/lib/RoadizRozierBundle/templates/attributes/groups/actionsMenu.html.twig b/lib/RoadizRozierBundle/templates/attributes/groups/actionsMenu.html.twig index c6d66e59c..ae92a3156 100644 --- a/lib/RoadizRozierBundle/templates/attributes/groups/actionsMenu.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/groups/actionsMenu.html.twig @@ -1,4 +1,4 @@ -{% embed "@RoadizRozier/macros/rz_actions_menu.html.twig" with { +{% embed "@RoadizRozier/components/rz_actions_menu.html.twig" with { vertical: true, class: 'actions-menu', item: item diff --git a/lib/RoadizRozierBundle/templates/attributes/groups/add.html.twig b/lib/RoadizRozierBundle/templates/attributes/groups/add.html.twig index 5fe5e13cb..867ac0de6 100644 --- a/lib/RoadizRozierBundle/templates/attributes/groups/add.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/groups/add.html.twig @@ -12,7 +12,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, { attr: { id: "add-attribute-group-form" }}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#add-attribute-group-form') }} {{ form_end(form) }} diff --git a/lib/RoadizRozierBundle/templates/attributes/groups/delete.html.twig b/lib/RoadizRozierBundle/templates/attributes/groups/delete.html.twig index 8c9a0cdaf..f2392b7d2 100644 --- a/lib/RoadizRozierBundle/templates/attributes/groups/delete.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/groups/delete.html.twig @@ -1,6 +1,6 @@ {% include '@RoadizRozier/admin/confirm_action.html.twig' with { 'title': "delete.attribute_group.%name%"|trans({'%name%': item.getName()}), - 'headPath': '@RoadizRozier/admin/head.html.twig', + 'headPath': '@RoadizRozier/layouts/head.html.twig', 'breadcrumb_parents': [breadcrumb_root('attributeGroups')], 'cancelPath': path('attributeGroupsHomePage'), 'alertMessage': 'are_you_sure.delete.attribute_group'|trans, diff --git a/lib/RoadizRozierBundle/templates/attributes/groups/edit.html.twig b/lib/RoadizRozierBundle/templates/attributes/groups/edit.html.twig index 51d39003f..a752bc51b 100644 --- a/lib/RoadizRozierBundle/templates/attributes/groups/edit.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/groups/edit.html.twig @@ -15,7 +15,7 @@ {% form_theme form '@RoadizRozier/forms.html.twig' %} {{ form_start(form, { attr: { id: "edit-attribute-form" }}) }} {{ form_widget(form) }} - {% import "@RoadizRozier/macros/rz_actions_menu.html.twig" as actions_menu %} + {% import "@RoadizRozier/components/rz_actions_menu.html.twig" as actions_menu %} {{ actions_menu.saveItem('#edit-attribute-form') }} {{ form_end(form) }} diff --git a/lib/RoadizRozierBundle/templates/attributes/groups/list.html.twig b/lib/RoadizRozierBundle/templates/attributes/groups/list.html.twig index 491fcb816..7a431f688 100644 --- a/lib/RoadizRozierBundle/templates/attributes/groups/list.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/groups/list.html.twig @@ -18,12 +18,12 @@ ], } only %} - {% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { + {% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, } only %}
- {% embed '@RoadizRozier/includes/rz_table.html.twig' with { + {% embed '@RoadizRozier/components/rz_table.html.twig' with { selection_available: hasBulkActions, actions_available: true, } %} @@ -46,7 +46,7 @@ {{- item.name -}} {% if actions_available %} - {% include '@RoadizRozier/includes/rz_table_actions.html.twig' with { + {% include '@RoadizRozier/components/rz_table_actions.html.twig' with { 'edit_href': path('attributeGroupsEditPage', { id: item.id }), 'delete_href': is_granted('ROLE_ACCESS_ATTRIBUTES_DELETE') ? path('attributeGroupsDeletePage', { id: item.id }) : null, } %} diff --git a/lib/RoadizRozierBundle/templates/attributes/head.html.twig b/lib/RoadizRozierBundle/templates/attributes/head.html.twig index 540250ddb..b1092beae 100644 --- a/lib/RoadizRozierBundle/templates/attributes/head.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/head.html.twig @@ -10,7 +10,7 @@ } %} {% endif %} -{% include "@RoadizRozier/admin/head.html.twig" with { +{% include "@RoadizRozier/layouts/head.html.twig" with { title: title, buttons: buttons, filters: filters, diff --git a/lib/RoadizRozierBundle/templates/attributes/import.html.twig b/lib/RoadizRozierBundle/templates/attributes/import.html.twig index de2964be6..6e3b6a5ce 100644 --- a/lib/RoadizRozierBundle/templates/attributes/import.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/import.html.twig @@ -1,5 +1,5 @@ {% extends '@RoadizRozier/layout.html.twig' %} -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% block title %}{% trans %}import.attributes{% endtrans %} | {{ parent() }}{% endblock %} diff --git a/lib/RoadizRozierBundle/templates/attributes/list.html.twig b/lib/RoadizRozierBundle/templates/attributes/list.html.twig index 114015332..e47c22c1c 100644 --- a/lib/RoadizRozierBundle/templates/attributes/list.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/list.html.twig @@ -40,7 +40,7 @@ ], } only %} - {% include "@RoadizRozier/widgets/rz_filters_bar.html.twig" with { + {% include "@RoadizRozier/components/rz_filters_bar.html.twig" with { filters: filters, display_select_all_button: true, } only %} diff --git a/lib/RoadizRozierBundle/templates/attributes/list_table.html.twig b/lib/RoadizRozierBundle/templates/attributes/list_table.html.twig index fd2eb69bc..b841a098b 100644 --- a/lib/RoadizRozierBundle/templates/attributes/list_table.html.twig +++ b/lib/RoadizRozierBundle/templates/attributes/list_table.html.twig @@ -1,4 +1,4 @@ -{% embed '@RoadizRozier/includes/rz_table.html.twig' %} +{% embed '@RoadizRozier/components/rz_table.html.twig' %} {% block thead_cells %} {% if not no_sort %} @@ -36,7 +36,7 @@ > {{ _self.selection_input(selection_available, item.id) }} - {% import '@RoadizRozier/macros/rz_link.html.twig' as rz_link %} + {% import '@RoadizRozier/components/rz_link.html.twig' as rz_link %} {{ rz_link.root({ label: item.code, attributes: { href: path('attributesEditPage', { id: item.id }) }, @@ -50,7 +50,7 @@ {{- item.typeLabel|trans -}} - {% import '@RoadizRozier/macros/rz_badge.html.twig' as rz_badge %} + {% import '@RoadizRozier/components/rz_badge.html.twig' as rz_badge %} {{ rz_badge.item({ label: ' ' ~ (item.attributeValues|length), }) }} @@ -61,7 +61,7 @@ {% if actions_available %} {% set delete_href = is_granted('ROLE_ACCESS_ATTRIBUTES_DELETE') ? path('attributesDeletePage', { id: item.id }) : null %} - {% include '@RoadizRozier/includes/rz_table_actions.html.twig' with { + {% include '@RoadizRozier/components/rz_table_actions.html.twig' with { 'edit_href': path('attributesEditPage', { id: item.id }), 'delete_href': delete_href, } %} diff --git a/lib/RoadizRozierBundle/templates/cache/deleteAssets.html.twig b/lib/RoadizRozierBundle/templates/cache/deleteAssets.html.twig index 47fc0c3b5..817c5c664 100644 --- a/lib/RoadizRozierBundle/templates/cache/deleteAssets.html.twig +++ b/lib/RoadizRozierBundle/templates/cache/deleteAssets.html.twig @@ -1,6 +1,6 @@ {% include '@RoadizRozier/admin/confirm_action.html.twig' with { 'title': "purge.generated_images.cache"|trans, - 'headPath': '@RoadizRozier/admin/head.html.twig', + 'headPath': '@RoadizRozier/layouts/head.html.twig', 'cancelPath': path('adminHomePage'), 'action_label': 'clear'|trans, 'action_icon': 'rz-icon-ri--flashlight-line', diff --git a/lib/RoadizRozierBundle/templates/cache/deleteDoctrine.html.twig b/lib/RoadizRozierBundle/templates/cache/deleteDoctrine.html.twig index eb2d5face..87257a060 100644 --- a/lib/RoadizRozierBundle/templates/cache/deleteDoctrine.html.twig +++ b/lib/RoadizRozierBundle/templates/cache/deleteDoctrine.html.twig @@ -1,6 +1,6 @@ {% include '@RoadizRozier/admin/confirm_action.html.twig' with { 'title': "purge.cache"|trans, - 'headPath': '@RoadizRozier/admin/head.html.twig', + 'headPath': '@RoadizRozier/layouts/head.html.twig', 'cancelPath': path('adminHomePage'), 'action_label': 'clear'|trans, 'action_icon': 'rz-icon-ri--flashlight-line', diff --git a/lib/RoadizRozierBundle/templates/macros/rz_actions_menu.html.twig b/lib/RoadizRozierBundle/templates/components/rz_actions_menu.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_actions_menu.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_actions_menu.html.twig diff --git a/lib/RoadizRozierBundle/templates/macros/rz_badge.html.twig b/lib/RoadizRozierBundle/templates/components/rz_badge.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_badge.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_badge.html.twig diff --git a/lib/RoadizRozierBundle/templates/macros/rz_breadcrumb.html.twig b/lib/RoadizRozierBundle/templates/components/rz_breadcrumb.html.twig similarity index 61% rename from lib/RoadizRozierBundle/templates/macros/rz_breadcrumb.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_breadcrumb.html.twig index 23e40eb89..2a5b55c31 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_breadcrumb.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_breadcrumb.html.twig @@ -25,7 +25,6 @@ admin/confirm_action.html.twig puts the deleted item and its ancestry above its own title. #} {% macro root(breadcrumb) %} - {% set item_template = '@RoadizRozier/includes/rz_breadcrumb_item.html.twig' %} {% set parents = breadcrumb.parents|default([]) %} {# Counts ancestors only, the current page excluded. #} {% set max_visible = 6 %} @@ -37,17 +36,16 @@
    {% if middle is empty %} {% for item in parents %} - {{ include(item_template, { item: item }, with_context = false) }} + {{ _self.item(item) }} {% endfor %} {% else %} - {{ include(item_template, { item: parents|first }, with_context = false) }} + {{ _self.item(parents|first) }} - {{ include('@RoadizRozier/macros/rz_overflow_list.html.twig', { + {% embed '@RoadizRozier/components/rz_overflow_list.html.twig' with { items: middle|slice(0, folded_count), visibleCount: 0, wrapperTag: 'li', wrapperClass: 'rz-breadcrumb__list-item', - itemTemplate: item_template, responsive: true, responsiveInline: middle|length - folded_count, popover: { @@ -57,19 +55,46 @@ label: '', ariaLabel: 'breadcrumb.show_more', }, - }, with_context = false) }} + } only %} + {% block item %} + {% if item is defined %} + {% import '@RoadizRozier/components/rz_breadcrumb.html.twig' as rz_breadcrumb %} + {{ rz_breadcrumb.item(item) }} + {% endif %} + {% endblock %} + {% endembed %} {% for item in middle|slice(folded_count) %} - {{ include(item_template, { item: item }, with_context = false) }} + {{ _self.item(item) }} {% endfor %} - {{ include(item_template, { item: parents|last }, with_context = false) }} + {{ _self.item(parents|last) }} {% endif %} - {{ include(item_template, { - item: { label: breadcrumb.current }, - current: true, - }, with_context = false) }} + {{ _self.item({ label: breadcrumb.current }, true) }}
{% endmacro %} + +{# + One breadcrumb entry. Shared by the trail and by its overflow popover: the markup is the + same in both places so the responsive collapse (utils/OverflowList.ts) can move a
  • + between them as is. Folded levels get their menu-entry look from CSS + (`.rz-overflow-list__list .rz-breadcrumb__item` in rz-breadcrumb.css). + + - item (required): a hash {label, url}, or an entity supported by a + BreadcrumbsItemFactory (Node, NodesSources, Tag, Folder, Document, Translation). + - current (optional): render as the current page, as plain text instead of a link. +#} +{% macro item(item, current = false) %} + {% set item = item is iterable ? item : getBreadcrumbsItem(item) %} + {% if item %} +
  • + {% if current %} + {{- item.label|truncate_title -}} + {% else %} + {{- item.label|truncate_title -}} + {% endif %} +
  • + {% endif %} +{% endmacro %} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_bulk.html.twig b/lib/RoadizRozierBundle/templates/components/rz_bulk_actions.html.twig similarity index 55% rename from lib/RoadizRozierBundle/templates/macros/rz_bulk.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_bulk_actions.html.twig index 1791eed67..e85790ee9 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_bulk.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_bulk_actions.html.twig @@ -1,5 +1,52 @@ +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} + + +

    + {% block title_content %} + {% trans %}bulk.actions{% endtrans %} + {% endblock %} +

    + +
    + {{ _self.deselect_all_button() }} + + {% block other_actions %}{% endblock %} + + {% block delete_form %} +
    + {% block delete_form_content %} + {% if delete_form_data %} + {% form_theme delete_form_data '@RoadizRozier/forms.html.twig' %} + {{ form_widget(delete_form_data) }} + {% endif %} + {% endblock %} + {{ + rz_button.root({ + attributes: { + type: 'submit', + title: title + }, + color: 'danger', + emphasis: 'primary', + icon: 'rz-icon-ri--delete-bin-7-line', + }) + }} +
    + {% endblock %} +
    + + {% block panels %}{% endblock %} +
    + {% macro select_all_button(attributes = {}) %} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {{ rz_button.root({ attributes: { @@ -16,7 +63,7 @@ {% endmacro %} {% macro deselect_all_button(attributes = {}) %} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {{ rz_button.root({ attributes: { diff --git a/lib/RoadizRozierBundle/templates/macros/rz_button.html.twig b/lib/RoadizRozierBundle/templates/components/rz_button.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_button.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_button.html.twig diff --git a/lib/RoadizRozierBundle/templates/macros/rz_card.html.twig b/lib/RoadizRozierBundle/templates/components/rz_card.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_card.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_card.html.twig diff --git a/lib/RoadizRozierBundle/templates/components/rz_color_scheme_switcher.html.twig b/lib/RoadizRozierBundle/templates/components/rz_color_scheme_switcher.html.twig new file mode 100644 index 000000000..afc673128 --- /dev/null +++ b/lib/RoadizRozierBundle/templates/components/rz_color_scheme_switcher.html.twig @@ -0,0 +1,49 @@ +{% set popover_id = "color-theme-switcher" %} +{% embed "@RoadizRozier/components/rz_dropdown.html.twig" with { + targetId: popover_id, + wrapper_tag: 'rz-color-scheme-switcher', + target_options: { + size: 'sm', + icon: 'rz-icon-ri--color-filter-line', + attributes: { + 'aria-label': 'show.color.theme'|trans, + }, + }, + popover_attributes: { + class: class|default(''), + }, +} %} + {% block items %} + {{ _self.item({ + selected: true, + label: 'color.system'|trans, + rightIcon: 'rz-icon-ri--computer-line', + attributes: { + type: 'button', + 'data-value': 'system', + command: '--update-color-scheme', + commandfor: popover_id, + } + }) }} + {{ _self.item({ + label: 'color.light'|trans, + rightIcon: 'rz-icon-ri--sun-line', + attributes: { + type: 'button', + 'data-value': 'light', + command: '--update-color-scheme', + commandfor: popover_id, + } + }) }} + {{ _self.item({ + label: 'color.dark'|trans, + rightIcon: 'rz-icon-ri--moon-line', + attributes: { + type: 'button', + 'data-value': 'dark', + command: '--update-color-scheme', + commandfor: popover_id, + } + }) }} + {% endblock %} +{% endembed %} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_dialog.html.twig b/lib/RoadizRozierBundle/templates/components/rz_dialog.html.twig similarity index 96% rename from lib/RoadizRozierBundle/templates/macros/rz_dialog.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_dialog.html.twig index 125f4804f..b978fa7e3 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_dialog.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_dialog.html.twig @@ -1,7 +1,7 @@ {# rz-dialog: options = Args (storybook/renderer/rzDialog.ts), story Components/Overlay/Dialog #} {% macro root(options = {}) %} {% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %} - {% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %} + {% import '@RoadizRozier/components/rz_button.html.twig' as rz_button %} {% set element_class = 'rz-dialog' %} {% set dialog_id = options.dialogId|default('rz-dialog') %} @@ -75,7 +75,7 @@ {% endmacro %} {% macro close(closeIconClass) %} - {% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %} + {% import '@RoadizRozier/components/rz_button.html.twig' as rz_button %} {{ rz_button.root({ iconClass: closeIconClass, diff --git a/lib/RoadizRozierBundle/templates/widgets/drawer.html.twig b/lib/RoadizRozierBundle/templates/components/rz_drawer.html.twig similarity index 97% rename from lib/RoadizRozierBundle/templates/widgets/drawer.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_drawer.html.twig index 7b4c2f54e..f0fbff623 100644 --- a/lib/RoadizRozierBundle/templates/widgets/drawer.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_drawer.html.twig @@ -1,4 +1,4 @@ -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {% set entity_ids = [] %} {% set is_sortable = isSortable|default('true') %} @@ -82,7 +82,7 @@ {% endif %} -{% import "@RoadizRozier/macros/rz_form_field.html.twig" as rz_form_field %} +{% import "@RoadizRozier/components/rz_form_field.html.twig" as rz_form_field %} {% if label is empty -%} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_dropdown_menu.html.twig b/lib/RoadizRozierBundle/templates/components/rz_dropdown.html.twig similarity index 83% rename from lib/RoadizRozierBundle/templates/macros/rz_dropdown_menu.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_dropdown.html.twig index 5e67220f1..b81e708ba 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_dropdown_menu.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_dropdown.html.twig @@ -8,7 +8,7 @@ {% for item in items %}
  • {% if item.badge is defined and item.badge %} - {% import "@RoadizRozier/macros/rz_badge.html.twig" as badge %} + {% import "@RoadizRozier/components/rz_badge.html.twig" as badge %} {{ badge.item({ label: item.badge.label, icon: item.badge.icon, @@ -125,6 +125,31 @@
  • {% endmacro %} +{# + With `target_options`, the menu comes with its own trigger: an holding the + rz-button that opens it (`placement`, `offset`, `shift` and `popover_attributes` tune the + popover). Without it, the caller renders the trigger and points it at `targetId`. +#} +{% set has_trigger = target_options is defined %} +{% if has_trigger %} + {% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %} + {% import '@RoadizRozier/components/rz_button.html.twig' as rz_button %} + + {% set targetId = targetId|default('rz-dropdown-' ~ random()) %} + {% set shift = shift|default(null) %} + {% set target_options_attributes = target_options.attributes|default({})|merge({ + popovertarget: targetId, + type: 'button', + }) %} + + + {{ rz_button.root(target_options|merge({ attributes: target_options_attributes })) }} +{% endif %} {% block wrapper %} {% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %} {% set classes = html_classes('rz-dropdown', class|default(''), { 'rz-dropdown--reverse': reverse }) %} @@ -152,3 +177,6 @@ {% endblock %} {% endblock %} +{% if has_trigger %} + +{% endif %} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_filters_bar.html.twig b/lib/RoadizRozierBundle/templates/components/rz_filters_bar.html.twig similarity index 61% rename from lib/RoadizRozierBundle/templates/macros/rz_filters_bar.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_filters_bar.html.twig index 1d3ae8002..353ee4529 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_filters_bar.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_filters_bar.html.twig @@ -1,4 +1,61 @@ -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} + + + {% if filters.description %} +

    {{ filters.description }}

    + {% endif %} + + {% if with_filter_form is not same as(false) %} +
    + {% if display_layout_fields %} + {% set value = filters.layout ?? app.request.query.get('layout') %} + {{ _self.layout_fields(value) }} + {% endif %} + + + {% block before_submit %}{% endblock %} + {{ + rz_button.root({ + attributes: { + type: 'submit', + }, + emphasis: 'secondary', + label: 'filter'|trans, + icon: 'rz-icon-ri--search-line' + }) + }} + {% if display_select_all_button %} + {% import '@RoadizRozier/components/rz_bulk_actions.html.twig' as rz_bulk_actions %} + {{ rz_bulk_actions.select_all_button() }} + {% endif %} +
    + {% endif %} + + + {% set hasItemPerPageParams = app.request.get('item_per_page') and (app.request.get('item_per_page') != 20) %} + {% set hasMorePage = filters.itemCount > filters.itemPerPage %} + + {% if hasItemPerPageParams or hasMorePage %} +
    + {% if hasMorePage %} + {{ _self.pagination(filters) }} + {% endif %} + + + {% if filters.pageCount > 1 or filters.itemCount > 10 %} + {# Keep select if there are multiple pages or enough items #} + {{ _self.item_per_page(filters.itemPerPage) }} + {% endif %} +
    + {% endif %} +
    {% macro layout_fields(value) %}
    diff --git a/lib/RoadizRozierBundle/templates/macros/rz_form_field.html.twig b/lib/RoadizRozierBundle/templates/components/rz_form_field.html.twig similarity index 96% rename from lib/RoadizRozierBundle/templates/macros/rz_form_field.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_form_field.html.twig index 976c40644..2d3e13f04 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_form_field.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_form_field.html.twig @@ -19,7 +19,7 @@ {{- label|trans -}} {% if attr['data-universal'] %} - {% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %} + {% import "@RoadizRozier/components/rz_badge.html.twig" as rz_badge %} {{ rz_badge.item({ size: 'xs', color: 'default', diff --git a/lib/RoadizRozierBundle/templates/widgets/rz_geotag_field.html.twig b/lib/RoadizRozierBundle/templates/components/rz_geotag.html.twig similarity index 97% rename from lib/RoadizRozierBundle/templates/widgets/rz_geotag_field.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_geotag.html.twig index 5c7986000..1950b849b 100644 --- a/lib/RoadizRozierBundle/templates/widgets/rz_geotag_field.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_geotag.html.twig @@ -1,5 +1,5 @@ -{% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} -{% import "@RoadizRozier/macros/rz_form_field.html.twig" as rz_form_field %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} +{% import "@RoadizRozier/components/rz_form_field.html.twig" as rz_form_field %} {% set field_attributes_whitelist = [ diff --git a/lib/RoadizRozierBundle/templates/macros/rz_header.html.twig b/lib/RoadizRozierBundle/templates/components/rz_header_nav_item.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_header.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_header_nav_item.html.twig diff --git a/lib/RoadizRozierBundle/templates/widgets/rz_language_switcher.html.twig b/lib/RoadizRozierBundle/templates/components/rz_language_switcher.html.twig similarity index 94% rename from lib/RoadizRozierBundle/templates/widgets/rz_language_switcher.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_language_switcher.html.twig index bb3a8807d..fc8db3188 100644 --- a/lib/RoadizRozierBundle/templates/widgets/rz_language_switcher.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_language_switcher.html.twig @@ -38,7 +38,7 @@ {% endif %} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} {{ rz_button.root(button_data|merge({ attributes: button_attr|merge(btn_attr) })) diff --git a/lib/RoadizRozierBundle/templates/macros/rz_link.html.twig b/lib/RoadizRozierBundle/templates/components/rz_link.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_link.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_link.html.twig diff --git a/lib/RoadizRozierBundle/templates/macros/rz_node_badge.html.twig b/lib/RoadizRozierBundle/templates/components/rz_node_badge.html.twig similarity index 98% rename from lib/RoadizRozierBundle/templates/macros/rz_node_badge.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_node_badge.html.twig index 5369b03e0..72ff3629f 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_node_badge.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_node_badge.html.twig @@ -98,7 +98,7 @@ }) %} {% endif %} - {% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %} + {% import "@RoadizRozier/components/rz_badge.html.twig" as rz_badge %} {{ rz_badge.item(default_options|merge(type_options)) }} {% endmacro %} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_overflow_list.html.twig b/lib/RoadizRozierBundle/templates/components/rz_overflow_list.html.twig similarity index 84% rename from lib/RoadizRozierBundle/templates/macros/rz_overflow_list.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_overflow_list.html.twig index ad4ac0d40..d22917791 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_overflow_list.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_overflow_list.html.twig @@ -1,5 +1,5 @@ {% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %} -{% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %} +{% import '@RoadizRozier/components/rz_button.html.twig' as rz_button %} {% set items = items|default([]) %} {% set visible_count = visibleCount|default(0) %} @@ -47,8 +47,6 @@ {% set visible_items = items|slice(0, visible_count) %} {% set overflow_items = items|slice(visible_count) %} -{% set item_template = itemTemplate|default(null) %} -{% set item_template_context = itemTemplateContext|default({}) %} {% set wrapperTag = wrapperTag|default('div') %} {# responsive: items fold into the popover when the wrapper's parent row is too narrow, and unfold again when it widens (utils/OverflowList.ts). The popover is then always rendered, @@ -69,13 +67,9 @@ {% if responsive_empty and visible_count == 0 %}hidden{% endif %} > {% for loop_item in visible_items %} - {% if item_template %} - {{ include(item_template, item_template_context|merge({ item: loop_item })) }} - {% else %} - {% with { item: loop_item } %} - {{ block('item') }} - {% endwith %} - {% endif %} + {% with { item: loop_item } %} + {{ block('item') }} + {% endwith %} {% endfor %} {% if overflow_items|length > 0 or responsive %} @@ -109,13 +103,9 @@ {# .rz-dropdown__list paints the surface the wrapping .rz-dropdown expects. #} <{{ popover_tag_list }} class="rz-dropdown__list rz-overflow-list__list"> {% for loop_item in overflow_items %} - {% if item_template %} - {{ include(item_template, item_template_context|merge({ item: loop_item })) }} - {% else %} - {% with { item: loop_item } %} - {{ block('item') }} - {% endwith %} - {% endif %} + {% with { item: loop_item } %} + {{ block('item') }} + {% endwith %} {% endfor %}
    diff --git a/lib/RoadizRozierBundle/templates/macros/rz_page_header.html.twig b/lib/RoadizRozierBundle/templates/components/rz_page_header.html.twig similarity index 94% rename from lib/RoadizRozierBundle/templates/macros/rz_page_header.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_page_header.html.twig index f3735b046..b4de209b3 100644 --- a/lib/RoadizRozierBundle/templates/macros/rz_page_header.html.twig +++ b/lib/RoadizRozierBundle/templates/components/rz_page_header.html.twig @@ -1,7 +1,7 @@ {% set breadcrumb_html %} {% block breadcrumb %} {% if breadcrumb is defined and breadcrumb %} - {% import '@RoadizRozier/macros/rz_breadcrumb.html.twig' as rz_breadcrumb %} + {% import '@RoadizRozier/components/rz_breadcrumb.html.twig' as rz_breadcrumb %} {{ rz_breadcrumb.root(breadcrumb) }} {% endif %} {% endblock %} @@ -46,7 +46,7 @@
    {% macro translations_bar(available_translations, path, pathParams, current, pathAddTranslations, pathAddTranslationsTitle) %} - {% import '@RoadizRozier/macros/rz_link.html.twig' as rz_link %} + {% import '@RoadizRozier/components/rz_link.html.twig' as rz_link %} {% if available_translations %}
    {%- for translation in available_translations -%} @@ -95,7 +95,7 @@ {% macro button_group(buttons) %} {%- if buttons and buttons|length > 0 -%} - {% import "@RoadizRozier/macros/rz_button.html.twig" as rz_button %} + {% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %}
    {%- for btn in buttons -%} {{ rz_button.root(btn|merge({emphasis : 'primary'})) }} diff --git a/lib/RoadizRozierBundle/templates/macros/rz_progress.html.twig b/lib/RoadizRozierBundle/templates/components/rz_progress.html.twig similarity index 100% rename from lib/RoadizRozierBundle/templates/macros/rz_progress.html.twig rename to lib/RoadizRozierBundle/templates/components/rz_progress.html.twig diff --git a/lib/RoadizRozierBundle/templates/components/rz_repeatable.html.twig b/lib/RoadizRozierBundle/templates/components/rz_repeatable.html.twig new file mode 100644 index 000000000..cfd1e3cb6 --- /dev/null +++ b/lib/RoadizRozierBundle/templates/components/rz_repeatable.html.twig @@ -0,0 +1,125 @@ +{% import "@RoadizRozier/components/rz_form_field.html.twig" as rz_form_field %} +{% import "@RoadizRozier/components/rz_button.html.twig" as rz_button %} + +{% set repeatable_id = id ~ '_repeatable'|default(random() ~ '_repeatable') %} + + {% if label is not same as(false) -%} + {% if label is empty -%} + {% set label = name|humanize %} + {%- endif -%} +
    + {{ rz_form_field.inner_head(label, label_attr, form, icon|default('rz-icon-ri--repeat-2-line'), attr, entityIds|length) }} + + {{ rz_button.root({ + label: 'repeatable.add'|trans, + icon: 'rz-icon-ri--add-line', + size: 'sm', + class: 'rz-form-field__head__end', + attributes: { + type: 'button', + 'command': '--add', + 'commandfor': repeatable_id, + 'data-insert-index': '0', + }, + }) }} +
    + + + +
    +
      + {% if stored_items_form is not null %} + {% for item in stored_items_form %} + {{ _self.item({ + repeatable_id: repeatable_id, + icon: icon|default(null), + label: label, + content: form_widget(item), + }) }} + {% endfor %} + {% endif %} +
    +
    + {{ rz_button.root({ + icon: 'rz-icon-ri--add-line', + attributes: { + type: 'button', + 'command': '--add', + 'commandfor': repeatable_id, + 'tooltip-text': 'insert.zone'|trans, + 'aria-label': 'collection.insert_item'|trans, + }, + }) }} +
    +
    + {% endif %} +
    + +{# + One entry of the list, also used as the