File tree Expand file tree Collapse file tree
src/BootstrapAdminUi/templates/shared/crud/index/content/grid Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 new Create (),
3737 new Update (),
3838 new Index (grid: BookGrid::class),
39+ new Index (
40+ template: '@SyliusAdminUi/crud/index.html.twig ' ,
41+ shortName: 'withoutGrid ' ,
42+ ),
3943 new Delete (),
4044 new BulkDelete (),
4145 new Show (),
Original file line number Diff line number Diff line change 22{% import ' @SyliusBootstrapAdminUi/shared/helper/pagination.html.twig' as pagination %}
33
44{% set resources = hookable_metadata .context .resources %}
5- {% set data = resources .data %}
6- {% set definition = resources .definition %}
5+ {% set data = resources .data | default ([]) %}
6+ {% set definition = resources .definition | default ( null ) %}
77
88{% if data | length > 0 %}
99 <div class =" card" >
Original file line number Diff line number Diff line change 66{% set path = path(app .request .attributes .get (' _route' ), app .request .attributes .all (' _route_params' )) %}
77{% set are_criteria_set = app .request .query .has (' criteria' ) %}
88
9- {% if resources .definition .enabledFilters is not empty %}
9+ {% if resources .definition .enabledFilters | default ([]) is not empty %}
1010 <div class =" position-relative z-1 bg-white mb-5" >
1111 {% set content %}
1212 <div class =" mb-3" >
Original file line number Diff line number Diff line change 11{% set resources = hookable_metadata .context .resources %}
22
3- {% if resources .data | length == 0 %}
3+ {% if resources .data is defined and resources . data | length == 0 %}
44 <div class =" card" >
55 <div class =" empty" >
66 {% hook ' no_results' %}
Original file line number Diff line number Diff line change @@ -98,6 +98,28 @@ public function testBrowsingBooks(): void
9898 self ::assertSelectorExists ('tr.item:last-child [data-bs-title=Delete] ' );
9999 }
100100
101+ public function testBrowsingBooksWithoutGrid (): void
102+ {
103+ BookFactory::new ()
104+ ->withTitle ('The Shining ' )
105+ ->withAuthorName ('Stephen King ' )
106+ ->create ()
107+ ;
108+
109+ BookFactory::new ()
110+ ->withTitle ('Carrie ' )
111+ ->withAuthorName ('Stephen King ' )
112+ ->create ()
113+ ;
114+
115+ $ this ->client ->request ('GET ' , '/admin/books/withoutGrid ' );
116+
117+ self ::assertResponseIsSuccessful ();
118+
119+ // Validate Header
120+ self ::assertSelectorTextContains ('[data-test-page-title] ' , 'Books ' );
121+ }
122+
101123 public function testSortingBooks (): void
102124 {
103125 BookFactory::new ()
You can’t perform that action at this time.
0 commit comments