diff --git a/VERSIONS_HOTLINE/156384 b/VERSIONS_HOTLINE/156384 new file mode 100644 index 0000000000000000000000000000000000000000..4ab32d4b17b7b3eb8281479ec1ed57206e5a2c0b --- /dev/null +++ b/VERSIONS_HOTLINE/156384 @@ -0,0 +1 @@ + - correctif #156384 : Magasin de thèmes : Dans l'onglet Details de la fiche bibliothèque, nous avons ajouté les classes "library_details_custom_field" et "library_details_attribut" pour faciliter l'intégration graphique. \ No newline at end of file diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 08285c03b638fac7e5d3e4e8b58f5fde994dac48..7167a795b3a601a9144387551266ce419058c5a5 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -334,7 +334,9 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'div class paginated_collection' => 'col-12 mt-3 list-group bg-transparent no_border', 'div class paginated_secondary_collection' => 'col-12 mt-3 list-group bg-transparent no_border', 'div class ajax_paginated_collection' => 'col-12', - 'div class paginated_collection_pager' => 'col' + 'div class paginated_collection_pager' => 'col', + 'div class library_details_attribut' => 'col-12', + 'div class library_details_custom_field' => 'col-12' ], 'icons_map_doc_types' => [], diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php index 488dde3125e5af98fcd0bc8157d3fe022c058121..5f1d3fb84732686b756a4b9392e993c793f0cb56 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php @@ -58,11 +58,11 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona 'getAnnexe' => $this->_('Annexe'), 'getResetPassword' => $this->_('Comment modifier mon mot de passe')]; - $html = []; - + $attributs_html = []; foreach ($column_map as $attrib => $label) - $html = $this->_addAttributAsHtml($attrib, $label, $html); + $attributs_html = $this->_addAttributAsHtml($attrib, $label, $attributs_html); + $custom_fields_html = []; $count = 0; foreach($this->_model->getAllCustomFields()->getFieldValues() as $field) { if ($field->getLabel() === $this->_('Tags bibliothèque')) @@ -72,25 +72,22 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona continue; $count++; - $html [] = $this->_renderBlock($this->_renderOptions($field, $count), - $field->getLabel(), - 'custom' . $count); + $custom_fields_html [] = + $this->_view->div(['class' => 'library_details_custom_field ' + . $this->_stripWord($field->getLabel())], + $this->_renderBlock($this->_renderOptions($field, $count), + $field->getLabel(), + 'custom' . $count)); } - $html = array_map(function($content) - { - return $this->_view->div(['class' => 'col-12'], - $content); - }, - $html); - - return $this->_view->grid(implode($html)); + return $this->_view->grid(implode(array_merge($attributs_html, + $custom_fields_html))); } protected function _addAttributAsHtml($attrib, $label, $html) { if ($value = $this->_model->$attrib()) - $html [] = $this->_view->div(['class' => 'col-12'], + $html [] = $this->_view->div(['class' => 'library_details_attribut ' . $this->_stripWord($label)], $this->_view->tag('h4', $label) . $this->_view->tag('p', diff --git a/tests/scenarios/Templates/TemplatesLibraryTest.php b/tests/scenarios/Templates/TemplatesLibraryTest.php index 8208a79ce3a3e286f84c1ee88189bffb1bbece3f..82b6940ae8092d084cc0b35520f8d0bf789679be 100644 --- a/tests/scenarios/Templates/TemplatesLibraryTest.php +++ b/tests/scenarios/Templates/TemplatesLibraryTest.php @@ -230,6 +230,7 @@ class TemplatesLibraryViewAnnecyTest extends TemplatesLibraryTestCase { 'model' => 'Bib']); Class_Bib::find(1) + ->setPret('C\'est génial vous pouvez emprunter') ->setCustomField('Services', ['Wifi', 'Restauration', 'l\'Médias']) ->setCustomField('Slogan', 'Vive le vélo') ->setCustomField('Fonds Spécifiques', 'La matériauthèque') @@ -245,9 +246,15 @@ class TemplatesLibraryViewAnnecyTest extends TemplatesLibraryTestCase { } + /** @test */ + public function pretTextShouldBeInDivClassLibraryDetailsPret() { + $this->assertXPathContentContains('//div[@class="library_details_attribut modalites_des_prets col-12"]/p', 'C\'est génial vous pouvez emprunter'); + } + + /** @test */ public function customOneLibraryBoxH4ShouldContainsServices() { - $this->assertXPathContentContains('//div[@class="custom1 library_box"]//h4', 'Services'); + $this->assertXPathContentContains('//div[@class="library_details_custom_field services col-12"]/div[@class="custom1 library_box"]//h4', 'Services'); }