diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index f7a8c6ba9647058c26102460cc20f8ad70caee21..348d3a42a05d3311c28003bb54779efc0cac2c29 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -60,7 +60,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getPicture() { - return $this->_model->getUrlImage(); + return $this->_model->fetchUrlLocalVignette(); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Review.php b/library/templates/Intonation/Library/View/Wrapper/Review.php index a4996db09ae9573414421a01e0f3c83404894767..75be785b6871d85703f8a1fe518a9d65903d300e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Review.php +++ b/library/templates/Intonation/Library/View/Wrapper/Review.php @@ -61,21 +61,23 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_model->getUrl(), - 'Text' => $this->_('Lire l\'avis'), - 'Title' => $this->_getMainLinkTitle(), - 'Popup' => true]); + if ($this->_model->getAvis()) + return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'blog', + 'action' => 'read-more', + 'id' => $this->_model->getId()], + null, + true), + 'Text' => $this->_('Lire l\'avis'), + 'Title' => $this->_getMainLinkTitle(), + 'Popup' => true]); } protected function _getMainLinkTitle() { - if ($author = $this->getAuthor()) - return $this->_('Lire l\'avis "%s" écrit par "%s"', - $this->getTitle(), - $this->getAuthor()); - - return $this->_('Lire l\'avis: %s', - $this->getTitle()); + return ($author = $this->getAuthor()) + ? $this->_('Lire l\'avis donné par "%s"', + $this->getAuthor()) + : $this->_('Lire l\'avis'); } diff --git a/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php b/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php index 3bc6efac8d7836db820bc3e00a2aeaf10b7069bd..8081b881f62ad0a1c067dfdb0ebb751a329dee84 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php +++ b/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php @@ -102,7 +102,7 @@ class Intonation_Library_View_Wrapper_ReviewsByRecord extends Intonation_Library public function getDescriptionTitle() { - return $this->_('Les avis du document : %s', $this->getTitle()); + return ''; } diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 648e57c92e533244cf660763ce331104c825597c..168a8c738ca65c94e0c214fccf4d6ed41bff810c 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -1865,7 +1865,6 @@ class TemplatesAddReviewTest extends TemplatesIntonationTestCase { - class TemplatesReviewsWidgetTest extends TemplatesIntonationTestCase { /** @test */ @@ -1908,4 +1907,69 @@ class TemplatesReviewsWidgetTest extends TemplatesIntonationTestCase { $this->dispatch('/opac/index/index/id_profil/72', true); $this->assertXPathContentContains('//div', 'Le Roi'); } +} + + + +class TemplatesBlogReviewsActionTest extends TemplatesIntonationTestCase { + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_AvisNotice', + ['id' => 4, + 'id_notice' => 2, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne']); + + $this->fixture('Class_Notice', + ['id' => 2, + 'clef_oeuvre' => 'PSYKO', + ]); + + $this->dispatch('/blog/reviews'); + } + + + /** @test */ + public function leRoiShouldBePresent() { + $this->assertXPathContentContains('//div', 'Le Roi'); + } +} + + + + +class TemplatesBlogReadMoreActionTest extends TemplatesIntonationTestCase { + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_AvisNotice', + ['id' => 4, + 'id_notice' => 2, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne']); + + $this->fixture('Class_Notice', + ['id' => 2, + 'clef_oeuvre' => 'PSYKO', + ]); + + $this->dispatch('/blog/read-more/id/4'); + } + + + /** @test */ + public function leRoiShouldBePresent() { + $this->assertXPathContentContains('//div', 'Le Roi'); + } } \ No newline at end of file