diff --git a/app/Grid/BookGrid.php b/app/Grid/BookGrid.php index e9a9ea10..03a887e9 100644 --- a/app/Grid/BookGrid.php +++ b/app/Grid/BookGrid.php @@ -59,7 +59,7 @@ public function buildGrid(GridBuilderInterface $gridBuilder): void ) ->addActionGroup( ItemActionGroup::create( - // ShowAction::create(), + ShowAction::create(), UpdateAction::create(), DeleteAction::create(), ), diff --git a/src/BootstrapAdminUi/config/app/grid/templates.php b/src/BootstrapAdminUi/config/app/grid/templates.php index 1dc1478b..fdd2c9fc 100644 --- a/src/BootstrapAdminUi/config/app/grid/templates.php +++ b/src/BootstrapAdminUi/config/app/grid/templates.php @@ -19,6 +19,7 @@ 'action' => [ 'create' => '@SyliusBootstrapAdminUi/shared/grid/action/create.html.twig', 'delete' => '@SyliusBootstrapAdminUi/shared/grid/action/delete.html.twig', + 'show' => '@SyliusBootstrapAdminUi/shared/grid/action/show.html.twig', 'update' => '@SyliusBootstrapAdminUi/shared/grid/action/update.html.twig', ], 'bulk_action' => [ diff --git a/src/BootstrapAdminUi/templates/shared/grid/action/show.html.twig b/src/BootstrapAdminUi/templates/shared/grid/action/show.html.twig new file mode 100644 index 00000000..227b35b6 --- /dev/null +++ b/src/BootstrapAdminUi/templates/shared/grid/action/show.html.twig @@ -0,0 +1,8 @@ +{% from '@SyliusBootstrapAdminUi/shared/helper/icon.html.twig' import icon %} + +{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('show')), options.link.parameters|default({'id': data.id}))) %} +{% set message = action.label|default('sylius.ui.show') %} + + + {{ icon({ icon: action.icon|default('eye'), class: 'icon icon-tabler' }) }} + diff --git a/tests/Functional/BookTest.php b/tests/Functional/BookTest.php index 4f6cc92b..237a9251 100644 --- a/tests/Functional/BookTest.php +++ b/tests/Functional/BookTest.php @@ -73,11 +73,13 @@ public function testBrowsingBooks(): void // Validate Table data self::assertSelectorTextContains('tr.item:first-child', 'Carrie'); self::assertSelectorTextContains('tr.item:first-child', 'Stephen King'); + self::assertSelectorExists('tr.item:first-child [data-bs-title=Show]'); self::assertSelectorExists('tr.item:first-child [data-bs-title=Edit]'); self::assertSelectorExists('tr.item:first-child [data-bs-title=Delete]'); self::assertSelectorTextContains('tr.item:last-child', 'Shinning'); self::assertSelectorTextContains('tr.item:last-child', 'Stephen King'); + self::assertSelectorExists('tr.item:last-child [data-bs-title=Show]'); self::assertSelectorExists('tr.item:last-child [data-bs-title=Edit]'); self::assertSelectorExists('tr.item:last-child [data-bs-title=Delete]'); }