Skip to content
Snippets Groups Projects
Commit 80cf03ed authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #23802 : items display back to legacy format

parent 556e98e9
Branches
Tags
3 merge requests!896Master,!846Dev#23802 add sito arborescence,!843Dev#23802 add sito arborescence
......@@ -142,7 +142,7 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Sitotheque extends
public function getCategoriesId() {
return 'sitotheque';
return 'sitotheque-category';
}
......
......@@ -22,16 +22,16 @@
class ZendAfi_View_Helper_PublicListViewMode extends ZendAfi_View_Helper_Admin_ListViewMode {
public function publicListViewMode($list) {
if(!$this->_list = $list)
if (!$this->_list = $list)
return '';
$html = $this->getSearchFormHTML()
.$this->getBreadcrumbHTML()
.$this->getCategoriesHTML()
. $this->getBreadcrumbHTML()
. $this->getCategoriesHTML()
. $this->getItemsHTML()
. $this->getItemsPaginatorHTML();
return $html;
return $html;
}
......@@ -39,40 +39,60 @@ class ZendAfi_View_Helper_PublicListViewMode extends ZendAfi_View_Helper_Admin_
if($this->_list->getSearchValue())
return '';
$labelWithCount = function($model, $attrib) {
return $this->view->tagAnchor($this->view->url($this->_list->getUrlParams($model),null, true),
$model->$attrib
. ' (' . $this->_list->countRecursiveItemsFor($model) . ')');};
$html = '';
foreach($this->_list->getCategories() as $category)
$html .= $this->getCategoryHtml($category);
return $this->_tag('ul', $html,
['class' => $this->_list->getCategoriesId()]);
}
return $this->view->tagList($this->_list->getCategories(),
$this->_list->getCategoriesAttribs(),
$this->_list->getCategoriesId(),
[$this->_list->getCategoriesLabelAttrib() => $labelWithCount]
protected function getCategoryHtml($category) {
$label_attrib = $this->_list->getCategoriesLabelAttrib();
$label = sprintf('%s (%s)',
$category->$label_attrib,
$this->_list->countRecursiveItemsFor($category));
);
return $this
->_tag('li',
$this->_tag('a', $label,
['href' => $this->view->url($this->_list->getUrlParams($category),
null, true)]));
}
protected function getItemsHTML() {
if(!$this->_list->getModel() && !$this->_list->getSearchValue())
return '';
$labelWithThumbnail = function($model, $attrib) {
$html='';
if ($img_url = $this->getThumbnail($model->getUrl()))
$html.= $this->view->tagImg($img_url,['alt' => ""]);
return $html.$this->view->tagAnchor($model->getUrl(),$model->$attrib,
['title' => 'Aller sur le site']);
};
return $this->view->tagList($this->_list->getItems(),
$this->_list->getItemsAttribs(),
$this->_list->getItemsId(),
[$this->_list->getItemsLabelAttrib() => $labelWithThumbnail]);
$html = '';
foreach ($this->_list->getItems() as $item)
$html .= $this->getItemHtml($item);
return $html;
}
protected function getItemHtml($item) {
if (!$item)
return '';
$html = $this->view->openBoiteContent($item->getTitre());
$thumb = ($img_url = $this->getThumbnail($item->getUrl())) ?
$this->view->tagImg($img_url) : '';
$link = $this
->_tag('div',
$this->_tag('a', $this->_('Voir le site'),
['href' => $item->getUrl()]));
$html .= $this->_tag('div',
$thumb . $item->getDescription() . $link,
['class' => $this->_list->getItemsId()]);
return $html . $this->view->closeBoiteContent();
}
......@@ -80,8 +100,7 @@ class ZendAfi_View_Helper_PublicListViewMode extends ZendAfi_View_Helper_Admin_
if (!isset($this->thumbnails_helper))
$this->thumbnails_helper = (new ZendAfi_View_Helper_WebThumbnail())
->setView($this->view);
return $this->thumbnails_helper->webThumbnail($url);
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -121,14 +121,14 @@ class SitoControllerHierarchicViewTest extends SitoControllerTestCase {
/** @test */
public function LinuxFrShouldNotBeShown() {
$this->assertNotXPath('//ul[@class="sitotheque"]//a[@href="http://linuxfr.org"]',
$this->assertNotXPath('//div[@class="sitotheque"]//a[@href="http://linuxfr.org"]',
$this->_response->getBody());
}
/** @test */
public function FramasoftShouldBeShown() {
$this->assertXPath('//ul[@class="sitotheque"]//a[@href="http://framasoft.org"]',
$this->assertXPath('//div[@class="sitotheque"]//a[@href="http://framasoft.org"]',
$this->_response->getBody());
}
......
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