From 368722d59e13c542ca389a0d9af0ab01bba52ed2 Mon Sep 17 00:00:00 2001 From: Patrick Barroca <pbarroca@afi-sa.fr> Date: Wed, 13 Jun 2018 10:15:32 +0200 Subject: [PATCH] dev #75882 fix bibListViewMode --- .../Action/Helper/BibListViewMode.php | 36 ++++++++----------- .../controllers/CmsControllerListModeTest.php | 3 +- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/library/ZendAfi/Controller/Action/Helper/BibListViewMode.php b/library/ZendAfi/Controller/Action/Helper/BibListViewMode.php index e0a3004e333..664c28bc4d4 100644 --- a/library/ZendAfi/Controller/Action/Helper/BibListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/BibListViewMode.php @@ -33,6 +33,21 @@ class ZendAfi_Controller_Action_Helper_BibListViewMode extends ZendAfi_Controlle } + protected function _describeCategoriesIn($description) { + return $description + ->addColumn($this->_('Localisation'), ['attribute' => 'libelle', + 'callback' => function ($model, $attrib) + { + return $this->_renderCategory($model, $attrib); + }]); + } + + + protected function _describeItemsIn($description) { + return $description; + } + + public function getBaseUrl() { return ['module' => 'admin', 'controller' => 'cms']; @@ -59,28 +74,7 @@ class ZendAfi_Controller_Action_Helper_BibListViewMode extends ZendAfi_Controlle } - public function countItemsFor($model) { - $id = $model ? $model->getId() : 0; - return Class_ArticleCategorie::countBy(['id_site' => $id]); - } - - - public function getCategoriesCols() { - return [$this->_('Localisation')]; - } - - - public function getCategoriesLabelAttrib() { - return 'libelle'; - } - - public function getStrategyLabel() { return 'bib'; } - - - public function getItemsPaginator() { - return new Zend_Paginator(new Zend_Paginator_Adapter_Null(0)); - } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php index 1925aad3e35..8c6a8ed11da 100644 --- a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php @@ -42,7 +42,8 @@ class CmsControllerListModeAdminRootTest extends CmsControllerListModeTestCase { /** @test */ public function shouldDisplayPortal() { $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/id_bib/0")]', - 'Portail'); + 'Portail', + $this->_response->getBody()); } -- GitLab