From fff096f38c4e6371879be21426a8d1e15f342192 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sat, 24 Oct 2026 11:51:35 +0200 Subject: [PATCH] Display groups full names in groups dropdowns --- templates/default/bookings.html.twig | 2 +- templates/default/event.html.twig | 2 +- .../Crud/tests/units/BookingsController.php | 20 ++++++++++++++++++ .../Crud/tests/units/EventsController.php | 21 +++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/templates/default/bookings.html.twig b/templates/default/bookings.html.twig index fbd5159..76bfa5f 100644 --- a/templates/default/bookings.html.twig +++ b/templates/default/bookings.html.twig @@ -95,7 +95,7 @@ diff --git a/templates/default/event.html.twig b/templates/default/event.html.twig index c45f3b2..b16522a 100644 --- a/templates/default/event.html.twig +++ b/templates/default/event.html.twig @@ -49,7 +49,7 @@ {% set group_list_values = {(0): _T("Select a group")} %} {% for group in groups %} - {% set group_list_values = group_list_values + {(group.getId()): group.getIndentName()} %} + {% set group_list_values = group_list_values + {(group.getId()): group.getFullName()} %} {% endfor %} {% include "components/forms/select.html.twig" with { diff --git a/tests/GaletteEvents/Controllers/Crud/tests/units/BookingsController.php b/tests/GaletteEvents/Controllers/Crud/tests/units/BookingsController.php index 40b5bcc..a2c9e5d 100644 --- a/tests/GaletteEvents/Controllers/Crud/tests/units/BookingsController.php +++ b/tests/GaletteEvents/Controllers/Crud/tests/units/BookingsController.php @@ -145,6 +145,26 @@ public function testVisitorCannotListBookings(): void } } + /** + * Sub groups are listed with their full name in the groups filter + */ + public function testListGroupsFullNames(): void + { + $this->logSuperAdmin(); + $parent = $this->createGroup('Parent group'); + $child = new \Galette\Entity\Group(); + $child->setName('Child group'); + $child->setParentGroup((int)$parent->getId()); + $this->assertTrue($child->store()); + + $body = (string)$this->app->handle($this->createRequest('events_bookings', ['event' => 'all']))->getBody(); + $this->assertStringContainsString( + sprintf('', $child->getId()), + $body + ); + $this->assertStringNotContainsString('»', $body); + } + /** * Members can neither display nor change bookings of other members */ diff --git a/tests/GaletteEvents/Controllers/Crud/tests/units/EventsController.php b/tests/GaletteEvents/Controllers/Crud/tests/units/EventsController.php index c8c370c..5d9efb1 100644 --- a/tests/GaletteEvents/Controllers/Crud/tests/units/EventsController.php +++ b/tests/GaletteEvents/Controllers/Crud/tests/units/EventsController.php @@ -278,6 +278,27 @@ public function testPastEventFormKeepsOpenFlag(): void $this->assertStringContainsString('value="1"', $matches[0]); } + /** + * Sub groups are listed with their full name, without HTML entities + */ + public function testFormGroupsFullNames(): void + { + $this->logSuperAdmin(); + $parent = $this->createGroup('Parent group'); + $child = new \Galette\Entity\Group(); + $child->setName('Child group'); + $child->setParentGroup((int)$parent->getId()); + $this->assertTrue($child->store()); + + $body = (string)$this->app->handle($this->createRequest('events_event_add'))->getBody(); + $this->assertMatchesRegularExpression( + sprintf('|\s*Parent group / Child group\s*|', $child->getId()), + $body + ); + $this->assertStringNotContainsString('»', $body); + $this->assertStringNotContainsString(' ', $body); + } + /** * Calendar requires dates */