Skip to content
Snippets Groups Projects
Commit 315aaafe authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

Merge branch...

Merge branch 'hotline#122926_gpsea_p1_page_notice_ou_le_trouver__ajout_bouton_reserver' into 'hotline'

hotline MT #122926 : Improve hold button in record page

See merge request !3822
parents b50ff48c b8617284
Branches
Tags
2 merge requests!3840Hotline,!3822hotline MT #122926 : Improve hold button in record page
Pipeline #12247 canceled with stage
in 21 minutes and 39 seconds
- ticket #122926 : Magasin de thèmes : Amélioration du bouton réserver de la page notice.
\ No newline at end of file
......@@ -22,15 +22,13 @@
class Chili_View_RenderRecord_RenderItems extends Intonation_View_RenderRecord_RenderItems {
protected function _hookForMoreHtml($items) {
if ( ! $first_item = reset($items))
return '';
if ( ! $first_item = $this->_getFirstHoldableItem($items))
return $this->_noHoldableItem();
if ( ! $record = $first_item->getNotice())
return '';
return $this->_noHoldableItem();
$hold = new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne',
'action' => 'reserver',
'record_id' => $record->getId()]),
$hold = new Intonation_Library_Link(['Url' => $first_item->getHoldLink(),
'Text' => $this->_('Réserver'),
'Image' => (Class_Template::current()
->getIco($this->view,
......@@ -42,5 +40,21 @@ class Chili_View_RenderRecord_RenderItems extends Intonation_View_RenderRecord_R
return $this->view->div(['class' => 'items_hold_link'],
$this->view->tagAction($hold));
}
protected function _noHoldableItem() {
return $this->view->div(['class' => 'items_hold_link no_holdable_item'],
$this->_('Réservation impossible, pas d\'exemplaire réservable'));
}
protected function _getFirstHoldableItem($items) {
return (new Storm_Collection($items))
->detect( function($item)
{
return $item->getHoldLink();
} );
}
}
......@@ -45,7 +45,47 @@ class ChiliItemsDispatchTest extends AbstractControllerTestCase {
/** @test */
public function pageShouldContainsLinkToHold() {
$this->assertXPathContentContains('//div[@class="items_hold_link col-12 p-3 my-3 text-center"]//a[contains(@href, "abonne/reserver")]',
$this->assertXPathContentContains('//div[@class="items_hold_link col-12 p-3 my-3 text-center"]//a[contains(@href, "/recherche/reservation/id_int_bib/0/id_bib/0/id_notice/2")]',
utf8_encode('Réserver'));
}
}
class ChiliItemsNoHoldableItemsDispatchTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_buildTemplateProfil(['id' => 3,
'template' => 'CHILI']);
$this->fixture('Class_Notice',
['id' => 2,
]);
$this->fixture('Class_Exemplaire',
['id' => 1,
'id_notice' => 2,
'id_bib' => 1
]);
$this->fixture('Class_Bib',
['id' => 1,
'libelle' => 'Montmin',
'interdire_resa' => 1
]);
$this->dispatch('noticeajax/items-resources/id/2');
}
/** @test */
public function pageShouldContainsNoHoldableItemMessage() {
$this->assertXPathContentContains('//div[@class="items_hold_link no_holdable_item col-12 p-3 my-3 text-center"]',
utf8_encode('Réservation impossible, pas d\'exemplaire réservable'));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment