Commit a44fef71 authored by Laurent's avatar Laurent

Merge branch 'hotline#109427_liste_verticale_a_intercations' into 'hotline'

hotline #10927: liste verticale intercation bootstrap fix

See merge request !3565
parents 9b46ef69 4fc4ef16
Pipeline #10519 canceled with stage
in 44 minutes and 49 seconds
- ticket #109427 : Magasin de thème : correction de la pagination/recherche dans la liste verticale à interactions
\ No newline at end of file
...@@ -147,6 +147,7 @@ class Intonation_Library_AjaxPaginatedListHelper { ...@@ -147,6 +147,7 @@ class Intonation_Library_AjaxPaginatedListHelper {
{ {
$element $element
->setView($this->_view) ->setView($this->_view)
->setModel($element->getModel())
->inJsSearch(); ->inJsSearch();
return false !== strpos(strtolower($element->getContentForJSSearch()), $term); return false !== strpos(strtolower($element->getContentForJSSearch()), $term);
}); });
......
...@@ -32,6 +32,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe ...@@ -32,6 +32,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe
$callback = function($element) use ($helper) { $callback = function($element) use ($helper) {
$element->setView($this->view); $element->setView($this->view);
$element->setModel($element->getModel());
return call_user_func_array([$this->view, $helper->getRendering()], [$element]); return call_user_func_array([$this->view, $helper->getRendering()], [$element]);
}; };
...@@ -62,7 +63,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe ...@@ -62,7 +63,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe
$page_size = $helper->getPageSize(); $page_size = $helper->getPageSize();
$count_pages = ceil( $count_result / $page_size ); $count_pages = ceil( $count_result / $page_size );
$count_pages = $count_pages < 1 ? 1 : $count_pages ;
return $this->view->div([], return $this->view->div([],
implode([$this->view->tagAnchor(['controller' => 'index', implode([$this->view->tagAnchor(['controller' => 'index',
'action' => 'ajax-paginated-list', 'action' => 'ajax-paginated-list',
...@@ -79,6 +80,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe ...@@ -79,6 +80,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe
$this->view->tagAnchor(['controller' => 'index', $this->view->tagAnchor(['controller' => 'index',
'action' => 'ajax-paginated-list', 'action' => 'ajax-paginated-list',
'id_profil' => Class_Profil::getCurrentProfil()->getId(),
'id' => $this->_id, 'id' => $this->_id,
'page' => $current_page +1], 'page' => $current_page +1],
$this->_tag('i','',['class' => 'fas fa-chevron-right m-0']), $this->_tag('i','',['class' => 'fas fa-chevron-right m-0']),
...@@ -95,6 +97,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe ...@@ -95,6 +97,7 @@ class Intonation_View_RenderAjaxPaginatedList extends ZendAfi_View_Helper_BaseHe
$form $form
->setAction($this->view->url(['controller' => 'index', ->setAction($this->view->url(['controller' => 'index',
'action' => 'ajax-paginated-list', 'action' => 'ajax-paginated-list',
'id_profil' => Class_Profil::getCurrentProfil()->getId(),
'id' => $this->_id, 'id' => $this->_id,
'size' => $helper->getPageSize(), 'size' => $helper->getPageSize(),
'page' => 1], null, true)) 'page' => 1], null, true))
......
...@@ -3491,6 +3491,63 @@ class TemplatesDispatchAbonneLoansTest extends TemplatesIntonationAccountTestCas ...@@ -3491,6 +3491,63 @@ class TemplatesDispatchAbonneLoansTest extends TemplatesIntonationAccountTestCas
} }
/** @test */
public function page2ReviewsShouldContainsSearchInputWithMd5Key() {
Storm_Cache::beVolatile();
$this->fixture('Class_AvisNotice',
['id' => 4,
'id_user' => 666,
'id_notice' => 2,
'clef_oeuvre' => 'PSYKO',
'note' => '4',
'entete' => 'Le Roi',
'avis' => 'Le Roi des cons sur son throne',
'source_author' => null]);
$this->fixture('Class_AvisNotice',
['id' => 5,
'id_user' => 666,
'id_notice' => 3,
'clef_oeuvre' => 'PSYKO',
'note' => '4',
'entete' => 'Le Roi des cons avec sa couronne',
'avis' => 'Le Roi des cons avec sa couronne',
'source_author' => null]);
$this->fixture('Class_Notice',
['id' => 2,
'clef_oeuvre' => 'PSYKO',
]);
$this->fixture('Class_Notice',
['id' => 3,
'clef_oeuvre' => 'PSYKOTIC',
]);
$reviews = Class_AvisNotice::groupByRecords(Class_AvisNotice::findAll());
$reviews = array_map(function($review)
{
return (new Intonation_Library_View_Wrapper_ReviewsByRecord)
->setModel($review)
->setView($this->view);
}, $reviews);
$collection = new Storm_Collection($reviews);
$helper = (new Intonation_Library_AjaxPaginatedListHelper)
->setCollection($collection)
->setRendering('cardifyHorizontal');
$id = $helper->getId();
$this->dispatch('/opac/index/ajax-paginated-list/id/' . $id . '/page/2/render/ajax/id_profil/72/size/1/search/roi');
$this->assertContains('input_69219ce1da1a3a70c6511767a99d5a05', $this->_response->getBody());
$this->assertContains('avec sa couronne', $this->_response->getBody());
}
/** @test */ /** @test */
public function loansShouldContainsDrHouse() { public function loansShouldContainsDrHouse() {
Storm_Cache::beVolatile(); Storm_Cache::beVolatile();
......
Markdown is supported
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