Skip to content

Commit

Permalink
[BootstrapAdminUi] Add template for show action (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 authored Sep 25, 2024
2 parents d3142b9 + e424b43 commit de49675
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Grid/BookGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function buildGrid(GridBuilderInterface $gridBuilder): void
)
->addActionGroup(
ItemActionGroup::create(
// ShowAction::create(),
ShowAction::create(),
UpdateAction::create(),
DeleteAction::create(),
),
Expand Down
1 change: 1 addition & 0 deletions src/BootstrapAdminUi/config/app/grid/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -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') %}

<a title="details" href="{{ path }}" class="btn btn-icon" data-bs-toggle="tooltip" data-bs-title="{{ message|trans }}" {{ sylius_test_html_attribute('show-action', message|trans ) }}>
{{ icon({ icon: action.icon|default('eye'), class: 'icon icon-tabler' }) }}
</a>
2 changes: 2 additions & 0 deletions tests/Functional/BookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]');
}
Expand Down

0 comments on commit de49675

Please sign in to comment.