diff --git a/library/ZendAfi/View/Helper/ListeNotices/Vignettes.php b/library/ZendAfi/View/Helper/ListeNotices/Vignettes.php index 2907deee7030327671a143f4d533da9d2dab1897..bc70491ef0d8334c4b0af77b1d90e8874af566f1 100644 --- a/library/ZendAfi/View/Helper/ListeNotices/Vignettes.php +++ b/library/ZendAfi/View/Helper/ListeNotices/Vignettes.php @@ -42,12 +42,12 @@ class ZendAfi_View_Helper_ListeNotices_Vignettes extends ZendAfi_View_Helper_Lis $read_speaker_tag = $read_speaker_helper->readSpeaker('recherche', 'readnotice', ['id' => $notice->getIdNotice()]); - //container $html='<div class="vignette" data-id="'.$notice->getId().'">'; - //lien reserver $html.='<div class="vignette_lien_reserver">'.$this->view->Notice_LienReserver($notice).'</div>'; + $html.='<div class="vignette_lien_panier">'.$this->view->tagAddToCart($notice).'</div>'; + $html.='<div class="vignette_titre">' .'<a href="'.$url_notice.'">'.$notice->getTitreEtSousTitre().'</a> '.$read_speaker_tag .'</div>'; diff --git a/library/ZendAfi/View/Helper/Notice/Mur.php b/library/ZendAfi/View/Helper/Notice/Mur.php index 73eee1cc29143f7080ce7231eed9450187562ca4..0ba9d87af0636c0df5b6274064685570a21c1eb2 100644 --- a/library/ZendAfi/View/Helper/Notice/Mur.php +++ b/library/ZendAfi/View/Helper/Notice/Mur.php @@ -92,11 +92,8 @@ class ZendAfi_View_Helper_Notice_Mur extends Zend_View_Helper_HtmlElement { public function barreDeLienPanier($notice) { - $url = $this->view->url(['controller' => 'panier', - 'action' => 'ajout-ajax', - 'id_notice' => $notice->getId()], null, true); - return '<li><a href="' . $url . '" data-popup="true" data-action="'. $url.'" title="'.$this->_("Ajouter au panier").'"> </a></li>'; + return $this->view->tag('li', $this->view->tagAddToCart($notice)); } } -?> +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagAddToCart.php b/library/ZendAfi/View/Helper/TagAddToCart.php new file mode 100644 index 0000000000000000000000000000000000000000..548f9b16acdd0d1456bd0c9ef55895eea9e40e0f --- /dev/null +++ b/library/ZendAfi/View/Helper/TagAddToCart.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_View_Helper_TagAddToCart extends Zend_View_Helper_HtmlElement { + use Trait_Translator; + + + public function tagAddToCart($notice) { + $url = $this->view->url(['controller' => 'panier', + 'action' => 'ajout-ajax', + 'id_notice' => $notice->getId()], null, true); + return $this->view->tagAnchor($url, + ' ', + ['data-popup' => "true", + 'data-action' => $url, + 'title' => $this->_("Ajouter au panier")]); + + } +} +?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 0b2d06f7222b960cdc2cbd45ae252b1c890be349..fa58cb98476cdb39e69869f942ee029c8dd8e3fa 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -927,6 +927,21 @@ class RechercheControllerSimpleActionWithListeFormatVignettesTest extends Recher parent::setUp(); $this->dispatch('/recherche/simple/expressionRecherche/potter/facettes/T1/facette/B1/page/2', true); } + + + + /** @test */ + public function withOutLoggedUserPopupLoginShouldBeInitialized() { + $this->assertXPathContentContains('//script', 'initializePopups'); + } + + + /** @test */ + public function linkAddToCartShouldBePresent() { + $this->assertXPath('//div[@class="vignette_lien_panier"]//a[contains(@href, "/panier/ajout-ajax/id_notice/")][@data-popup="true"]'); + } + + /** @test */ public function pageShouldContainsDivListeVignette() { $this->assertXPath('//div[@class="liste_vignettes"]'); @@ -1615,7 +1630,7 @@ class RechercheControllerAjoutNoticePanierUrlWithMurConfigTest extends Recherche /** @test */ public function withOutLoggedUserPopupLoginShouldBeInitialized() { - $this->assertXPathContentContains('//script', 'initializePopups', $this->_response->getBody()); + $this->assertXPathContentContains('//script', 'initializePopups'); }