diff --git a/VERSIONS_HOTLINE/123916 b/VERSIONS_HOTLINE/123916 new file mode 100644 index 0000000000000000000000000000000000000000..4e69d403995ca669f756d81cbeba2403d156326f --- /dev/null +++ b/VERSIONS_HOTLINE/123916 @@ -0,0 +1 @@ + - ticket #123916 : Magasin de thèmes : ajout du bouton réinitialiser la recherche dans le résultat de recherche. \ No newline at end of file diff --git a/library/templates/Chili/View/Search/Result.php b/library/templates/Chili/View/Search/Result.php index 6153fb1959947a33f535df49cbb1e4b6e3ab9b2b..cb7522f78041f66f92ebbd32d29f91435c5c9ebb 100644 --- a/library/templates/Chili/View/Search/Result.php +++ b/library/templates/Chili/View/Search/Result.php @@ -214,7 +214,9 @@ $(id).on('hide.bs.dropdown', function () { $('body').removeClass('overflow_hidde protected function _searchCriteriaButtons() { - return ''; + return + $this->_div(['class' => 'd-none d-lg-block'], + parent::_searchCriteriaButtons()); } diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 15c6ad382e366442ba83c4ecb177b8e1c19a75da..0cb1a42887a7984e39342c4856723d82a33e1317 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -209,6 +209,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'div class custom_advanced_search' => 'order-6', 'button class search_submit_button' => 'order-7', 'a class active_criteria' => 'btn btn-warning btn-sm mt-2 mr-2 text-dark text-left', + 'a class reset_criteria' => 'btn btn-info btn-sm mt-2 mr-2 text-dark text-left', 'button class reset_search' => 'btn btn-sm btn-warning border-dark', 'div class multi_facets_submit' => 'btn btn-sm btn-primary mb-2', diff --git a/library/templates/Intonation/View/Search/HtmlCriteria.php b/library/templates/Intonation/View/Search/HtmlCriteria.php index 501954c806d1b87b9016782dc5e6c5faa41e9250..f9541c7dc8f329dc85a886f6d87a139877ec14d8 100644 --- a/library/templates/Intonation/View/Search/HtmlCriteria.php +++ b/library/templates/Intonation/View/Search/HtmlCriteria.php @@ -37,15 +37,50 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere $this->visitCriteresRecherche($criteres_recherche); $this->_injectMultiFacets(); + $this->_wrapCriteria(); + $this->_addResetButton(); return $this->_cache = $this->_wrapHtml(); } + protected function _wrapCriteria() { + if ( ! $this->_html) + return $this; + + $this->_html = $this->_div(['class' => 'd-inlini-block align-items-start'], + $this->_html); + + return $this; + } + + + protected function _addResetButton() { + if ( ! $this->_html) + return $this; + + $url = + $this->view->url($this->_criteres_recherche->getUrlCriteresWithoutFacettes(), + null, + true); + + $link = + new Intonation_Library_Link(['Url' => $url, + 'Image' => $this->view->templateIco('clean', 'utils'), + 'Text' => $this->_('Réinitialiser'), + 'Title' => $this->_('Supprimer les facettes'), + 'InlineText' => 1, + 'Class' => 'reset_criteria']); + + $this->_html .= $this->view->tagAction($link); + return $this; + } + + protected function _wrapHtml() { return $this->_html ? ($this->_tag('div', $this->_html, - ['class' => 'criteres_recherche'])) + ['class' => 'criteres_recherche d-flex justify-content-between'])) : ''; } diff --git a/library/templates/Intonation/View/Search/TextCriteria.php b/library/templates/Intonation/View/Search/TextCriteria.php index 3cd8c74f1d65f7629af06d1d8969efeada4a3575..79dda410628f35ad626d6ee98451f8328c2fe570 100644 --- a/library/templates/Intonation/View/Search/TextCriteria.php +++ b/library/templates/Intonation/View/Search/TextCriteria.php @@ -32,6 +32,16 @@ class Intonation_View_Search_TextCriteria extends Intonation_View_Search_HtmlCri } + protected function _wrapCriteria() { + return $this; + } + + + protected function _addResetButton() { + return $this; + } + + public function visitCatalogue($catalogue) { $this->_domain = $catalogue; diff --git a/tests/scenarios/Templates/ChiliTest.php b/tests/scenarios/Templates/ChiliTest.php index 1ab444e91f8a4eb23f86b606c7b74e97ad43c253..1a018d5d2265b2d281079b171fb24bbca9c0504c 100644 --- a/tests/scenarios/Templates/ChiliTest.php +++ b/tests/scenarios/Templates/ChiliTest.php @@ -567,8 +567,14 @@ class ChiliSearchResultWithFacetsTest extends ChiliTemplateTestCase { /** @test */ - public function searchCriteriaButtonShouldNotBePresent() { - $this->assertNotXPath('//div[contains(@class, "search_criteria_col")]'); + public function searchCriteriaButtonsShouldBePresentInLg() { + $this->assertXPath('//div[contains(@class, "search_criteria_col")]//div[contains(@class, "d-none d-lg-block")]'); + } + + + /** @test */ + public function searchCriteriaButtonsShouldResetAnchor() { + $this->assertXPath('//div[contains(@class, "search_criteria_col")]//div[contains(@class, "d-none d-lg-block")]//a[@href= "/recherche/simple/expressionRecherche/pomme"]'); } diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index 3e700ff00123d8c70dddb3ed943571250f892dbf..07f902dc19f5e8f362c1e231f3b876fdf9463d77 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -134,7 +134,7 @@ class TemplatesDispatchIntonationSearchTest extends TemplatesIntonationTestCase /** @test */ public function linkToDeleteFacetShoulContainsMultifacetT3() { - $this->assertXPathContentContains('//div[@class="criteres_recherche"]//a[@href="/recherche/simple/expressionRecherche/pomme/multifacets/T1"]', 'Site:'); + $this->assertXPathContentContains('//div[@class="criteres_recherche d-flex justify-content-between"]//a[@href="/recherche/simple/expressionRecherche/pomme/multifacets/T1"]', 'Site:'); }