diff --git a/VERSIONS_HOTLINE/134110 b/VERSIONS_HOTLINE/134110 new file mode 100644 index 0000000000000000000000000000000000000000..ebef77a5a599f4e86ec634877ed1017f53ad7506 --- /dev/null +++ b/VERSIONS_HOTLINE/134110 @@ -0,0 +1,3 @@ + - ticket #134110 : Magasin de thèmes : Amélioration de l'affichage de l'historique de prêts. + Celui-ci est affiché dans un accordéon. + Les éléments de liste sont affichées en carrousel à trois colonnes. \ No newline at end of file diff --git a/library/templates/Chili/Template.php b/library/templates/Chili/Template.php index fecfe52c05f9cfa924c946f37e96f2cd1d4a31f5..e884be9dbd4ef3bebd22316730c35941dabfe324 100644 --- a/library/templates/Chili/Template.php +++ b/library/templates/Chili/Template.php @@ -80,7 +80,7 @@ class Chili_Template extends Intonation_Template { return Chili_View_RenderTopHighlightCarousel::class; if (Chili_Library_Widget_Carousel_Definition::ACCORDION_CAROUSEL == $layout) - return Chili_View_RenderAccordionCarousel::class; + return Intonation_View_RenderAccordionCarousel::class; if (Chili_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL == $layout) return Chili_View_RenderLeftHighlightCarousel::class; diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 76ae0028393cc22cd481a37b821331c035dec753..9ee31e6f52a12dd3f43f63e823a52d32018cf3eb 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -289,6 +289,9 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'div class review_title' => 'col-12', 'div class score_rating' => 'col-12 col-lg-6 text-md-left', 'div class score_date' => 'col-12 col-lg-5 text-md-right', + 'div class loans_list' => 'col-12', + 'div class numerical_loans_list' => 'col-12 mt-5', + 'div class historical_loans_list' => 'col-12 mt-5', ], 'icons_map_doc_types' => [], @@ -479,4 +482,4 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { return array_values(array_unique($merged)); } -} \ No newline at end of file +} diff --git a/library/templates/Intonation/View/Abonne/AjaxLoans.php b/library/templates/Intonation/View/Abonne/AjaxLoans.php index ee2bb9fe2907a8dfc2c47756e0b8a8d6de8e77fe..deb641854cabca773992717a4247c2278c9aac09 100644 --- a/library/templates/Intonation/View/Abonne/AjaxLoans.php +++ b/library/templates/Intonation/View/Abonne/AjaxLoans.php @@ -58,7 +58,7 @@ class Intonation_View_Abonne_AjaxLoans extends ZendAfi_View_Helper_BaseHelper { 'Loans' => $cards->getPNBLoans()])) : ''; - $history = $this->view->abonne_LoansList(new Class_Entity(['Profile' => Class_Profil::getCurrentProfil(), + $history = $this->view->abonne_HistoryLoansList(new Class_Entity(['Profile' => Class_Profil::getCurrentProfil(), 'RequestParams' => [], 'User' => $this->_model, 'Loans' => $cards->getLoansHistory([])])); @@ -66,18 +66,26 @@ class Intonation_View_Abonne_AjaxLoans extends ZendAfi_View_Helper_BaseHelper { $html = []; if ($loans = $this->view->abonne_LoansList($settings)) - $html [] = $this->view->div(['class' => 'col-12'], $loans); + $html [] = $this->view->div(['class' => 'loans_list'], $loans); if ($pnb) - $html [] = $this->view->div(['class' => 'col-12'], + $html [] = $this->view->div(['class' => 'numerical_loans_list'], $this->view->tag('h3', $this->_('Prêts numériques en cours')) . $pnb); if ($history) - $html [] = $this->view->div(['class' => 'col-12'], - $this->view->tag('h3', $this->_('Historique des prêts')) - . $history); + $html [] = $this->view->div(['class' => 'historical_loans_list'], + $this->_accordionHistory($history)); return $this->view->grid($html); } + + + protected function _accordionHistory($history) { + $title = new Storm_Collection([new Class_Entity(['MainTitle' => $this->_('Historique des prêts')])]); + return $this->view->renderAccordionCarousel($title, function($element) use ($history) + { + return $history; + }); + } } \ No newline at end of file diff --git a/library/templates/Intonation/View/Abonne/HistoryLoansList.php b/library/templates/Intonation/View/Abonne/HistoryLoansList.php new file mode 100644 index 0000000000000000000000000000000000000000..14e70986a4347092327252eba545308cc564c59c --- /dev/null +++ b/library/templates/Intonation/View/Abonne/HistoryLoansList.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Intonation_View_Abonne_HistoryLoansList extends Intonation_View_Abonne_LoansList { + + + public function abonne_HistoryLoansList($user) { + return parent::abonne_LoansList($user); + } + + protected function _renderList($collection, $actions) { + return $this->view->renderMultipleCarousel($collection, null, 3); + } +} diff --git a/library/templates/Intonation/View/Abonne/LoansList.php b/library/templates/Intonation/View/Abonne/LoansList.php index 5b2056b66a2e71f4940f5c5a025b02b5fc469548..0b80e05a50f412c7f5bfe12116d7f9bae67e6012 100644 --- a/library/templates/Intonation/View/Abonne/LoansList.php +++ b/library/templates/Intonation/View/Abonne/LoansList.php @@ -46,8 +46,12 @@ class Intonation_View_Abonne_LoansList extends ZendAfi_View_Helper_BaseHelper { return ''; $actions = $this->_getActions(); + return $this->_renderList(new Storm_Collection($loans), $actions); + } + - return $this->view->renderCollection(new Storm_Collection($loans), $actions, null, 20); + protected function _renderList($collection, $actions) { + return $this->view->renderCollection($collection, $actions, null, 20); } diff --git a/library/templates/Intonation/View/Abstract/Carousel.php b/library/templates/Intonation/View/Abstract/Carousel.php index 2ebba999d2f5e47db1db792ff52a6cac493d19fb..2a00a7d93fc3c64bc6da8696b41e5fde521d5579 100644 --- a/library/templates/Intonation/View/Abstract/Carousel.php +++ b/library/templates/Intonation/View/Abstract/Carousel.php @@ -25,6 +25,13 @@ abstract class Intonation_View_Abstract_Carousel extends ZendAfi_View_Helper_Bas if ($collection->isEmpty()) return ''; + $callback = $callback + ? $callback + : (function($item) + { + return $this->view->cardify($item); + }); + $id = 'carousel_' . uniqid(); $content = $this->_carouselInner($collection, $id, $callback) diff --git a/library/templates/Chili/View/RenderAccordionCarousel.php b/library/templates/Intonation/View/RenderAccordionCarousel.php similarity index 89% rename from library/templates/Chili/View/RenderAccordionCarousel.php rename to library/templates/Intonation/View/RenderAccordionCarousel.php index 7743402a8bdbb814d75b4910bc9532cdb6608d85..e899a00a869a3756069a96d8db72a515f8c4562d 100644 --- a/library/templates/Chili/View/RenderAccordionCarousel.php +++ b/library/templates/Intonation/View/RenderAccordionCarousel.php @@ -20,7 +20,7 @@ */ -class Chili_View_RenderAccordionCarousel extends ZendAfi_View_Helper_BaseHelper { +class Intonation_View_RenderAccordionCarousel extends ZendAfi_View_Helper_BaseHelper { protected $_id; @@ -40,7 +40,7 @@ class Chili_View_RenderAccordionCarousel extends ZendAfi_View_Helper_BaseHelper return ''; foreach($elements as $element) { - $html []= (new Chili_View_RenderAccordionCarousel_Content($this->view, + $html []= (new Intonation_View_RenderAccordionCarousel_Content($this->view, $element, $this->_id)) ->beCollapsed() @@ -55,7 +55,7 @@ class Chili_View_RenderAccordionCarousel extends ZendAfi_View_Helper_BaseHelper -class Chili_View_RenderAccordionCarousel_Content extends ZendAfi_View_Helper_BaseHelper { +class Intonation_View_RenderAccordionCarousel_Content extends ZendAfi_View_Helper_BaseHelper { protected $_id, $_expanded = true, @@ -109,6 +109,13 @@ class Chili_View_RenderAccordionCarousel_Content extends ZendAfi_View_Helper_Bas protected function _content($content_callback) { + $content_callback = $content_callback + ? $content_callback + : (function($item) + { + return $this->view->cardifyHorizontal($item); + }); + $class = $this->_expanded ? 'show' : ''; $attribs = ['id' => $this->_collapse_id, 'class' => 'accordion_content collapse ' . $class, diff --git a/library/templates/Intonation/View/RenderCarousel.php b/library/templates/Intonation/View/RenderCarousel.php index 82f8815266d4fbce354ae29643dc8812a9d93713..9a5b43de3470d36f45fe69e1bbbc2e7de5a923ad 100644 --- a/library/templates/Intonation/View/RenderCarousel.php +++ b/library/templates/Intonation/View/RenderCarousel.php @@ -22,7 +22,7 @@ class Intonation_View_RenderCarousel extends Intonation_View_Abstract_Carousel { - public function renderCarousel($collection, $callback) { + public function renderCarousel($collection, $callback = null) { return $this->_renderCarousel($collection, $callback); } diff --git a/library/templates/Intonation/View/RenderMultipleCarousel.php b/library/templates/Intonation/View/RenderMultipleCarousel.php index 8794b6df34e56db4573bfe1242a89970eca750f6..0a31e250282e7cead83b393065c898cce3085028 100644 --- a/library/templates/Intonation/View/RenderMultipleCarousel.php +++ b/library/templates/Intonation/View/RenderMultipleCarousel.php @@ -25,7 +25,7 @@ class Intonation_View_RenderMultipleCarousel extends Intonation_View_Abstract_Ca protected $_columns = 5; - public function renderMultipleCarousel($collection, $callback, $number_of_columns = '') { + public function renderMultipleCarousel($collection, $callback = null, $number_of_columns = '') { $this->setNumberOfColumns($number_of_columns); return $this->_renderCarousel($collection, $callback); } diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index e9ed85c171f22a4aeb5cf8aeb46659e0cd760333..29165635d3ec23f75a8c789c23a26dad4fe75c63 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -561,11 +561,25 @@ class TemplatesDispatchAbonneLoansWithHistoryTest extends TemplatesIntonationAcc /** @test */ public function pageShouldContainsPottifar() { - $this->assertXPathContentContains('//div','Pottifar'); + $this->assertXPathContentContains('//div', 'Pottifar'); + } + + + /** @test */ + public function historyShouldBeInAnAccordion() { + $this->assertXPathContentContains('//div[@class="accordion"]//h2', utf8_encode('Historique des prêts')); + } + + + /** @test */ + public function pottifarShouldBeInACarousel() { + $this->assertXPathContentContains('//div[contains(@class, "historical_loans_list col-12 mt-5")]//div[@class="accordion"]//div[contains(@class, "carousel")]//div', 'Pottifar'); } } + + class TemplatesDispatchAbonneHoldsTest extends TemplatesIntonationAccountTestCase { public function setUp(){ parent::setUp();