Skip to content
Snippets Groups Projects
Commit 8717b2f3 authored by Laurent's avatar Laurent
Browse files

hotline #25358 sito search

fix search in sub category
parent 7a63cbe8
Branches
Tags
2 merge requests!947Hotline master,!934Hotline#25358 sito search
......@@ -78,6 +78,12 @@ class ZendAfi_Controller_Action_Helper_SitothequeListViewMode extends ZendAfi_Co
}
public function getSearchUrl() {
return parent::getSearchUrl() + ['start_cat' => $this->getRequestParam('start_cat')];
}
protected function getSearchParams() {
$search_params = ['where' => 'titre like \'%' . trim($this->getSearch()) . '%\'',
'order' => 'titre'];
......
......@@ -42,9 +42,6 @@ class ZendAfi_View_Helper_Admin_ListViewMode extends ZendAfi_View_Helper_BaseHel
if (!$this->_list->isSearchEnabled())
return '';
$url = $this->view->url($this->_list->getSearchUrl(), null, true);
$submit = "$('#list_search_form').submit(function(event) {event.preventDefault(); event.stopImmediatePropagation(); var search = $('#list_title_search').val();var url = '". $url ."' + search; document.location.href = url;});";
$search_input = $this->_tag('input', '',
['type' => 'text',
'name' => 'title_search',
......@@ -52,13 +49,14 @@ class ZendAfi_View_Helper_Admin_ListViewMode extends ZendAfi_View_Helper_BaseHel
'placeholder' => $this->_('titre du document'),
'value' => $this->_list->getSearchValue()]);
Class_ScriptLoader::getInstance()->addJQueryReady($submit);
$search_button = $this->_tag('button', $this->_('Filtrer'),
['id' => 'list_filter_button']);
return $this->_tag('form', $search_input . $search_button,
['style' => 'text-align: right;',
'action' => $this->view->url(array_filter($this->_list->getSearchUrl()),
null,
true),
'id' => 'list_search_form']);
}
......
......@@ -59,6 +59,7 @@ abstract class SitoControllerTestCase extends AbstractControllerTestCase {
abstract class SitoControllerViewCategoyTestCase extends SitoControllerTestCase {
public function setUp() {
parent::setUp();
......@@ -195,6 +196,13 @@ class SitoControllerViewCategorySearchTest extends SitoControllerViewCategoyTest
$this->assertNotXPath('//div[@class="sitotheque"]//a[@href="http://linuxfr.org"]',
$this->_response->getBody());
}
/** @test */
public function formTitleSearchShouldContainsStartCat() {
$this->assertXPath('//form[@id="list_search_form"][@action="/sito/viewcategory/start_cat/12"]',
$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