diff --git a/VERSIONS_HOTLINE/52594 b/VERSIONS_HOTLINE/52594 new file mode 100644 index 0000000000000000000000000000000000000000..ad2ff4f21a3f1b275353912e0d9c0f370f92a4b9 --- /dev/null +++ b/VERSIONS_HOTLINE/52594 @@ -0,0 +1 @@ + - ticket #52594 : Administration : les images configurées dans les menus verticaux sont automatiquement cliquables \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php index a560eb2fe95ef1cab45bf6baa6d1c5552da8e393..942106905fb347e01f7dabc26fff7b7e7462a9ae 100644 --- a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php +++ b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php @@ -193,21 +193,26 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $target = ($param_url["target"] > "") ? $param_url["target"] : null; $a_href = $url ? "href='".htmlspecialchars($url)."'" : ""; - $a_target = $target ? "target='$target'" : ""; + $a_target = $target ? ['target' => $target] : []; $class = $this->_getContextClass(isset($menuitem["preferences"]["clef_profil"]) ? (int) $menuitem["preferences"]['clef_profil'] : '0'); $content ='<li class="'.$class.'">'; - $content .= $this->getMenuPicto($menuitem); - - $content .= - '<a '.$a_href.' '.$a_target.' >'. - htmlspecialchars($menuitem["libelle"]). - '</a>'; - + $content .= $this->_getMenuEntry(htmlspecialchars($url), $a_target, $menuitem); $content .= '</li>'; return $content; } + protected function _getMenuEntry($url, $target, $item, $sub_menu = false) { + $sub_menu = $sub_menu + ? $this->afficherSousMenu($url) + : []; + + return $this->view->tagAnchor($url, + $this->getMenuPicto($item) . htmlspecialchars($item['libelle']), + array_merge($target, $sub_menu)); + } + + /** * @param array $menuitem * @return string @@ -295,11 +300,10 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue private function _renderListItem($menuitem, $url = '#', $target = null) { $a_target = $target ? ['target' => $target] : []; - $content = $this->view->tagAnchor($url, - $this->getMenuPicto($menuitem) - . htmlspecialchars($menuitem['libelle']), - array_merge($a_target, - $this->afficherSousMenu($url))); + $content = $this->_getMenuEntry($url, + $a_target, + $menuitem, + true); if($this->preferences['new_html']=='1') { $content.= $this->_getSubItemsHtml($menuitem['sous_menus']); diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 9b5bddb5cf180ad41b971e40645ddb5895ad2085..ef25c26a40c43782f41b226b01d353365b141723 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -2638,6 +2638,12 @@ class ProfilOptionsControllerToggleMenuAndResponsiveOptionsTest extends ProfilOp public function toggleMenuCallFunctionShouldBePresent() { $this->assertXPathContentContains('//script', '$("#header #boite_1").toggle_menu_slider();'); } + + + /** @test */ + public function bookmarkImageShouldBeInAnchor() { + $this->assertXPath('//ul/li/a/img[contains(@src, "bookmark.png")]'); + } } @@ -2664,7 +2670,7 @@ class ProfilOptionsControllerSelectedActionInMenuVerticalWidgetTest extends Prof /** @test */ public function liBokehFaqShouldNotHaveClassSelectedAction() { - $this->assertXPathContentContains('//ul/li//ul/li[@class="menuGauche"]', 'Bokeh FAQ'); + $this->assertXPathContentContains('//ul/li//ul/li[@class="menuGauche"]/a', 'Bokeh FAQ'); } }