diff --git a/VERSIONS_HOTLINE/122292 b/VERSIONS_HOTLINE/122292 new file mode 100644 index 0000000000000000000000000000000000000000..6dbb00b243a876a1045267c5d70c5e243cffc4e5 --- /dev/null +++ b/VERSIONS_HOTLINE/122292 @@ -0,0 +1 @@ + - ticket #122292 : Magasin de thèmes : amélioration de la configuration du résultat de recherche. Vous pouvez maintenant choisir le rendu par défaut du résultat entre mur et liste. \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php index 621f17fe46be8e405c3391215796343aa2fba3aa..e2e91b6fd8f13bb5446285d4e836ec93614d3373 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php +++ b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php @@ -54,6 +54,12 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult 'facets_order', ['label' => $this->_('Trier les facettes [A-z]')]) + ->addElement('radio', + 'liste_format', + ['label' => $this->_('Rendu par défaut du résultat'), + 'multiOptions' => [Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST => $this->_('liste'), + Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR => $this->_('mur')]]) + ->addElement('userfile', Class_Notice_Xsl::KEY, ['label' => $this->_('Fichier XSL'), @@ -81,7 +87,7 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult ? ['by_work'] : []; $display_elements[] = Class_Notice_Xsl::KEY; - + $display_elements[] = 'liste_format'; $this->addToDisplaySettingsGroup($display_elements); parent::initDisplayGroups(); diff --git a/library/templates/Intonation/Library/ProfilePatcher.php b/library/templates/Intonation/Library/ProfilePatcher.php index 2e29bbfcb4d9460725abf0ca8d72a75b29131fab..4d0fb073539d81413530bc854323815bd77574a0 100644 --- a/library/templates/Intonation/Library/ProfilePatcher.php +++ b/library/templates/Intonation/Library/ProfilePatcher.php @@ -76,6 +76,7 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher { ->setCfgSiteParam('couleur_lien_bandeau', '') ->setCfgSiteParam('couleur_texte_bandeau', '') ->setAccessLevel(-1); + $codes = (new Class_Codification)->getCodesForFacets(); (new Class_Profil_Preferences()) ->setModulePref($this->_profile, @@ -83,9 +84,10 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher { 'resultat', 'simple')), ['boite' => ['no_border'], - 'facettes_codes' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'facettes_codes' => implode($codes), + 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST, 'facets_order' => 1, - 'facets_closed_codes' => 'ABCDEFGHIJKLMNOPQRSUVWXYZ']); + 'facets_closed_codes' => implode(array_diff($codes,[Class_TypeDoc::CODE_FACETTE]))]); return $this; } diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index 5a9d676e10b1f0eaf6352d8907e829003df33953..03b1e34b894528872836cc16d941b7234fb97903 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -556,3 +556,69 @@ class TemplatesSearchReservationPickupAjaxConnectedUserTest extends TemplatesSea $this->_xpath->assertXPathContentContains($this->_html,'//div[contains(@class, "hold_site_selection_message")]','<b>This is an additional text message</b>'); } } + + + + +abstract class TemplatesSearchDispatchTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil( + ['id' => 5, + 'template' => 'CHILI']); + + $records = [$this->fixture('Class_Notice', + ['id' => 89]), + $this->fixture('Class_Notice', + ['id' => 99])]; + ZendAfi_Auth::getInstance()->clearIdentity(); + Zend_Registry::set('sql', + $this->mock() + ->whenCalled('fetchAll') + ->answers([[89, 'T1', 'ACCROCDUROC-PRATCHETTT'], + [99, 'T2', 'ACCROCDUROC-PRATCHETTT'],])); + } +} + + + + +class TemplatesSearchDispatchWithDefaultRenderingTest extends TemplatesSearchDispatchTest { + + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/recherche/simple/expressionRecherche/pomme/id_profil/5'); + } + + + /** @test */ + public function defaultRenderingShouldBeListMode() { + $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[contains(@class, "list-group")]//div[contains(@class, "card")]'); + } +} + + + + +class TemplatesSearchDispatchWithWallDefaultRenderingTest extends TemplatesSearchDispatchTest { + + public function setUp() { + parent::setUp(); + (new Class_Profil_Preferences()) + ->setModulePref(Class_Profil::getCurrentProfil(), + (new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple')), + ['liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR]); + + $this->dispatch('/opac/recherche/simple/expressionRecherche/pomme/id_profil/5'); + } + + + /** @test */ + public function defaultRenderingShouldBeListMode() { + $this->assertXPath('//main//div[contains(@class,"search_records_col")]//div[contains(@class, "masonry")]//div[contains(@class, "card")]'); + } +} \ No newline at end of file diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index 244f990d4e07549810afe506c4123edf977dfe5a..7a3325d7df4697344c3b4c2f0b5a2b8572fd2e9b 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -1025,6 +1025,13 @@ class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTest } + /** @test */ + public function radioDefaultRenderingShouldBePresent() { + $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); + $this->assertXPath('//input[@type="radio"][@name="liste_format"][@value="2"][@checked]'); + } + + /** @test */ public function customCssClassesShouldHaveBeenSaved() {