From 67e732428c7fae25ea6b2afcb8b042546a009fed Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Fri, 27 Sep 2019 11:46:56 +0200 Subject: [PATCH] hotline#95882 : fix display error on library box in smartphone version --- VERSIONS_HOTLINE/95882 | 1 + .../ZendAfi/View/Helper/Telephone/Library.php | 6 ++ .../View/Helper/Telephone/RenderLibrary.php | 4 +- .../controllers/IndexControllerTest.php | 83 ++++++++++++++++++- 4 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 VERSIONS_HOTLINE/95882 diff --git a/VERSIONS_HOTLINE/95882 b/VERSIONS_HOTLINE/95882 new file mode 100644 index 00000000000..4c07676c303 --- /dev/null +++ b/VERSIONS_HOTLINE/95882 @@ -0,0 +1 @@ + - ticket #95882 : Boite bibliothèque : Correction affichage sans pagination dans la version smartphone \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Telephone/Library.php b/library/ZendAfi/View/Helper/Telephone/Library.php index 0194af17a71..ccfc482c5ba 100644 --- a/library/ZendAfi/View/Helper/Telephone/Library.php +++ b/library/ZendAfi/View/Helper/Telephone/Library.php @@ -19,4 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Telephone_Library extends ZendAfi_View_Helper_Accueil_Library { + + public function getHtml() { + $this->preferences['pagination'] = ''; + $this->preferences['nb_aff'] = 100; + return parent::getHtml(); + } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Telephone/RenderLibrary.php b/library/ZendAfi/View/Helper/Telephone/RenderLibrary.php index 2d31113cad2..161e359505a 100644 --- a/library/ZendAfi/View/Helper/Telephone/RenderLibrary.php +++ b/library/ZendAfi/View/Helper/Telephone/RenderLibrary.php @@ -25,10 +25,8 @@ class ZendAfi_View_Helper_Telephone_RenderLibrary extends ZendAfi_View_Helper_Ba if (!$library) return ''; - $html = [$this->view->toolbar($this->_("Bib")), - + $html = [ $this->_tag('h1', $this->view->escape($library->getLibelle())), - $this->_libraryInfo($library) ]; diff --git a/tests/application/modules/telephone/controllers/IndexControllerTest.php b/tests/application/modules/telephone/controllers/IndexControllerTest.php index 07105dd0d0e..114f4f91f63 100644 --- a/tests/application/modules/telephone/controllers/IndexControllerTest.php +++ b/tests/application/modules/telephone/controllers/IndexControllerTest.php @@ -673,4 +673,85 @@ class IndexControllerEmbedWithAccordionListWidgetTest extends AbstractIndexContr public function ericTruffazArticleContentShouldBePresent() { $this->assertXPathContentContains('//li[@data-role="collapsible"]//article', 'A Bonlieu <img src="truffaz.jpg"/>.'); } -} \ No newline at end of file +} + + + + +class IndexControllerTelephoneLibraryDisplayTest extends TelephoneAbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, + $_annecy, + $_meythet; + + protected function _loginHook($account) { + $account->ROLE = ""; + $account->ROLE_LEVEL = 0; + $account->ID_USER = ""; + $account->PSEUDO = ""; + } + + public function setUp() { + parent::setUp(); + + $this->_annecy = $this->fixture('Class_Bib', + ['id' => 1, + 'libelle' => 'Annecy', + 'ville' => 'Annecy', + 'id_zone' => 1, + 'ouvertures' => []]); + + $this->_meythet = $this->fixture('Class_Bib', + ['id' => 2, + 'libelle' => 'Meythet', + 'ville' => 'Meythet', + 'closed_on_holidays' => true, + 'ouvertures' => []]); + $cfg_accueil = + ['modules' => ['1' => [ 'division' => '1', + 'type_module' => 'LIBRARY', + 'preferences' => ['osm_map' => 0, + 'titre' => 'libraries', + 'allow_link_on_title' => true, + 'libraries' => '1;2', + 'nb_aff' => 1, + 'pagination' => Class_Systeme_ModulesAccueil_Library::PAGINATION_BOTH]]]]; + + Class_Profil::getCurrentProfil() + ->setCfgAccueil($cfg_accueil) + ; + + $this->fixture('Class_Lieu', + ['id' => 11, + 'libelle' => 'Bibliotheque d\'Annecy', + 'latitude' => '6.456789', + 'longitude' => '0.123456']); + + $this->fixture('Class_Lieu', + ['id' => 12, + 'libelle' => 'Bibliotheque de Meythet', + 'latitude' => '6.996789', + 'longitude' => '0.223456']); + + $this->_annecy + ->setIdLieu(11) + ->assertSave(); + + $this->_meythet->setIdLieu(12)->assertSave(); + + $this->dispatch('/', true); + } + + + /** @test */ + public function page1LinkShouldNotBePresent() { + $this->assertNotXPath('//div[@class="paginationControl"]'); + } + + + /** @test */ + public function bothBibShouldBePresent() { + $this->assertXPathContentContains('//h1', 'Meythet'); + $this->assertXPathContentContains('//h1', 'Annecy',$this->_response->getBody()); + } +} -- GitLab