Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# UPGRADE

## Unreleased

### BootstrapAdminUi

* The create/update content composition gained a `body` hookable that renders
the Tabler `.page-body` wrapper. The `form_error_alert` and `form` hookables
moved inside it:

| Before | After |
|---|---|
| `sylius_admin.common.create.content.form_error_alert` | `sylius_admin.common.create.content.body.form_error_alert` |
| `sylius_admin.common.create.content.form` | `sylius_admin.common.create.content.body.form` |
| `sylius_admin.common.update.content.form_error_alert` | `sylius_admin.common.update.content.body.form_error_alert` |
| `sylius_admin.common.update.content.form` | `sylius_admin.common.update.content.body.form` |

Hook configuration and templates targeting these hookables or their children
(e.g. `…content.form.sections.general`) must be retargeted accordingly. Apps
that overrode `shared/crud/common/content/form.html.twig` to add the missing
`.page-body` themselves should drop that override to avoid double wrapping.
12 changes: 9 additions & 3 deletions src/BootstrapAdminUi/config/app/twig_hooks/common/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
'header' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/header.html.twig',
],
'body' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/body.html.twig',
],
],

'sylius_admin.common.create.content.body' => [
'form_error_alert' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form_error_alert.html.twig',
],
Expand Down Expand Up @@ -89,19 +95,19 @@
],
],

'sylius_admin.common.create.content.form' => [
'sylius_admin.common.create.content.body.form' => [
'sections' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections.html.twig',
],
],

'sylius_admin.common.create.content.form.sections' => [
'sylius_admin.common.create.content.body.form.sections' => [
'general' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections/general.html.twig',
],
],

'sylius_admin.common.create.content.form.sections.general' => [
'sylius_admin.common.create.content.body.form.sections.general' => [
'default' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections/general/default.html.twig',
],
Expand Down
12 changes: 9 additions & 3 deletions src/BootstrapAdminUi/config/app/twig_hooks/common/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
'header' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/header.html.twig',
],
'body' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/body.html.twig',
],
],

'sylius_admin.common.update.content.body' => [
'form_error_alert' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form_error_alert.html.twig',
],
Expand Down Expand Up @@ -91,19 +97,19 @@
],
],

'sylius_admin.common.update.content.form' => [
'sylius_admin.common.update.content.body.form' => [
'sections' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections.html.twig',
],
],

'sylius_admin.common.update.content.form.sections' => [
'sylius_admin.common.update.content.body.form.sections' => [
'general' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections/general.html.twig',
],
],

'sylius_admin.common.update.content.form.sections.general' => [
'sylius_admin.common.update.content.body.form.sections.general' => [
'default' => [
'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/form/sections/general/default.html.twig',
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="page-body">
{% hook 'body' %}
</div>
13 changes: 13 additions & 0 deletions src/BootstrapAdminUi/tests/Functional/TemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ public function testIndexTemplate(): void
$this->assertAnySelectorTextSame('.nav-link-title', 'Dashboard'); // with "messages" domain
$this->assertAnySelectorTextSame('.nav-link-title', 'Library'); // with "menu" domain
}

public function testCreateTemplatePageStructure(): void
{
$this->client->request('GET', '/books/new');

$this->assertResponseIsSuccessful();
// Tabler layout: .page-body must be the .page-header's sibling — its
// top margin provides the header-to-content spacing.
$this->assertSelectorExists('.page-wrapper > .page-header');
$this->assertSelectorExists('.page-header + .page-body');
$this->assertSelectorExists('.page-body form');
$this->assertSelectorExists('.page-body form input[name="book_resource[name]"]');
}
}
Loading