From 76a74fbdecb74ba7a53dd4cdf5cc9ea8d611840e Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Mon, 16 May 2022 15:03:28 +0200 Subject: [PATCH] dev #156524 search result and items list now use grid layout instead of wall --- UPGRADE.fr.md | 6 ++++-- VERSIONS_WIP/156524 | 1 + .../Intonation/View/RenderRecord/RenderItems.php | 12 ++++++------ library/templates/Intonation/View/Search/Result.php | 12 +++++------- tests/scenarios/Templates/ChiliItemsTest.php | 8 +++----- .../scenarios/Templates/TemplatesSearchItemsTest.php | 4 ++-- tests/scenarios/Templates/TemplatesSearchTest.php | 4 ++-- 7 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 VERSIONS_WIP/156524 diff --git a/UPGRADE.fr.md b/UPGRADE.fr.md index 5a50b9e9937..380872348b7 100644 --- a/UPGRADE.fr.md +++ b/UPGRADE.fr.md @@ -114,7 +114,9 @@ vous devez procéder à l'étape d'installation de chacune d'elle. - 8.0.154 - 20/03/2022 : Suite à une amélioration RGAA des thèmes du magasin de thèmes, les tag "a" servant à afficher un dropdown ont été modifiés en tag "button". -## Changement de bibliothèques indispensables au fonctionnement de Bokeh pouvant impacter vos scripts et votre charte graphique - - 8.0.158 - 16/05/2022 : Passage de jQuery 3.2.1 en 3.6.0 + - 8.0.159 - 31/05/2020 : Suite à une amélioration de l'ergonomie, le résultat de recherche + et la liste des exemplaires dans le magasin de thèmes passent de + l'affichage mur à l'affichage grille. + diff --git a/VERSIONS_WIP/156524 b/VERSIONS_WIP/156524 new file mode 100644 index 00000000000..8159ecb088e --- /dev/null +++ b/VERSIONS_WIP/156524 @@ -0,0 +1 @@ + - correctif #156524 : Magasin de thèmes : le résultat de recherche et la liste des exemplaires passent par défaut de l'affichage mur à l'affichage grille. \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderRecord/RenderItems.php b/library/templates/Intonation/View/RenderRecord/RenderItems.php index 5237fd6e07f..6d327695a33 100644 --- a/library/templates/Intonation/View/RenderRecord/RenderItems.php +++ b/library/templates/Intonation/View/RenderRecord/RenderItems.php @@ -148,10 +148,10 @@ abstract class Intonation_View_RenderRecord_RenderItemsStrategy { protected function _renderItemsHTMLInner(array $items) : string { - return ($this->_view->newHelper('RenderWall')) - ->renderWall($this->_initCollection($this->_sortItems($items), - $this->_getItemWrapper()), - fn($element) => $this->_view->renderingDescription($element)); + return ($this->_view->newHelper('RenderWallGrid')) + ->renderWallGrid($this->_initCollection($this->_sortItems($items), + $this->_getItemWrapper()), + fn($element) => $this->_view->renderingDescription($element)); } @@ -204,7 +204,7 @@ abstract class Intonation_View_RenderRecord_RenderItemsStrategy { return $this->_view->renderPaginatedCollection($collection, - Intonation_Library_Widget_Carousel_Definition::WALL, + Intonation_Library_Widget_Carousel_Definition::GRID, Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, Class_Profil_ItemsSettings::current()->getPaginationThreshold()); } @@ -237,7 +237,7 @@ abstract class Intonation_View_RenderRecord_RenderItemsStrategy { Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, Class_Profil_ItemsSettings::current()->getPaginationThreshold(), $secondary_collection, - Intonation_Library_Widget_Carousel_Definition::WALL, + Intonation_Library_Widget_Carousel_Definition::GRID, Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION); return $html; diff --git a/library/templates/Intonation/View/Search/Result.php b/library/templates/Intonation/View/Search/Result.php index 93b619d12d4..45aa6a377e4 100644 --- a/library/templates/Intonation/View/Search/Result.php +++ b/library/templates/Intonation/View/Search/Result.php @@ -276,15 +276,13 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { protected function _renderWall(array $records) : string { - // Strictly use this helper to avoid Chili_View_RenderWall - $helper = (new Intonation_View_RenderWall) + // Strictly use this helper to avoid Chili_View_RenderWallGrid + $helper = (new Intonation_View_RenderWallGrid) ->setView($this->view); - return $helper->renderWall(new Storm_Collection($records), - function($wrapped) - { - return $this->view->renderingVertical($wrapped); - }); + return + $helper->renderWallGrid(new Storm_Collection($records), + fn($wrapped) => $this->view->renderingVertical($wrapped)); } diff --git a/tests/scenarios/Templates/ChiliItemsTest.php b/tests/scenarios/Templates/ChiliItemsTest.php index 64b39343468..2dd4c8498dd 100644 --- a/tests/scenarios/Templates/ChiliItemsTest.php +++ b/tests/scenarios/Templates/ChiliItemsTest.php @@ -85,16 +85,14 @@ class ChiliItemsDispatchTest extends AbstractControllerTestCase { /** @test */ public function sameWorkItemsTitleShouldBeDisplay() { $this->assertXPathContentContains('//div[@class="same_work_items col-12 mt-3"]/h3', - utf8_encode('Exemplaires de la même œuvre'), - $this->_response->getBody()); + utf8_encode('Exemplaires de la même œuvre')); } /** @test */ public function itemsMasonryIdShouldBeFirstUniqid() { $this->assertXPath('//div[@class="items_wall col-12"]' - . '//div[@id="' . $this->_uniqids[0] . '"][@class="masonry"]', - $this->_response->getBody()); + . '//div[@id="' . $this->_uniqids[0] . '"][@class="masonry masonry_grid"]'); } @@ -110,7 +108,7 @@ class ChiliItemsDispatchTest extends AbstractControllerTestCase { public function sameWorkMasonryIdShouldBeSecondUniqid() { $this->assertXPath('//div[@class="same_work_items col-12 mt-3"]' . '//div[@class="same_work_items_collection col-12"]' - . '//div[@id="' . $this->_uniqids[1] . '"][@class="masonry"]'); + . '//div[@id="' . $this->_uniqids[1] . '"][@class="masonry masonry_grid"]'); } diff --git a/tests/scenarios/Templates/TemplatesSearchItemsTest.php b/tests/scenarios/Templates/TemplatesSearchItemsTest.php index e1459e8b76e..9a5675f3f94 100644 --- a/tests/scenarios/Templates/TemplatesSearchItemsTest.php +++ b/tests/scenarios/Templates/TemplatesSearchItemsTest.php @@ -292,7 +292,7 @@ class TemplatesSearchItems15ItemsPaginationThreshold5AndAvailabilityKohaLimit9Te /** @test */ public function shouldDisplay5ItemsInWallHasCardDescription() { - $this->assertXPathCount('//div[@class="masonry"]//div[@class="masonry-brick"]//div[contains(@class, "card card_template")]//div[contains(@class,"card-title card_title")]', + $this->assertXPathCount('//div[@class="masonry masonry_grid"]//div[@class="masonry-brick"]//div[contains(@class, "card card_template")]//div[contains(@class,"card-title card_title")]', 5); } @@ -1026,7 +1026,7 @@ class TemplatesSearchItems15ItemsPaginationThreshold12AndAvailabilityKohaLimit1A /** @test */ public function paginatedMasonryShouldBePresent() { - $this->assertXPath('//div[@class="container-fluid"]/div[@class="row no-gutters"]/div[@class="paginated_secondary_collection col-12 mt-3 list-group bg-transparent no_border"]/div[contains(@class, "masonry")]'); + $this->assertXPath('//div[@class="container-fluid"]/div[@class="row no-gutters"]/div[@class="paginated_secondary_collection col-12 mt-3 list-group bg-transparent no_border"]/div[@class="masonry masonry_grid"]'); } diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index eda30b9a836..9108e566b76 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -840,7 +840,7 @@ class TemplatesSearchDispatchWithWallDefaultRenderingTest extends TemplatesSearc /** @test */ public function defaultRenderingShouldBeListMode() { - $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[contains(@class, "masonry")]//div[contains(@class, "card")]'); + $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[@class= "masonry masonry_grid"]//div[contains(@class, "card")]'); } /** @test */ @@ -1101,7 +1101,7 @@ class TemplatesSearchDispatchWallModeRenderingInChiliTest extends TemplatesSearc /** @test */ public function renderingShouldBeWallModeMasonry() { - $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[contains(@class, "masonry")]//div[contains(@class, "card")]'); + $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[@class= "masonry masonry_grid"]//div[contains(@class, "card")]'); } -- GitLab