fix menu tab

This commit is contained in:
Romuald 2016-06-10 12:58:31 +02:00
parent 51c84be1d3
commit 71c94a2fca
5 changed files with 41 additions and 28 deletions

View File

@ -118,8 +118,10 @@ class AdvMenu extends Module
}
}
public function loadMenu()
public function loadMenu($isCms)
{
$this->smarty->assign('isCms', (int) $isCms);
if (!$this->isCached('advmenu.tpl', $this->getCacheId())) {
$menuLinks = AdvMenuLink::getMenu();
if (!$menuLinks) {

View File

@ -4,5 +4,5 @@ require dirname(dirname(__FILE__)).'/../init.php';
require dirname(__FILE__).'/advmenu.php';
$module = new AdvMenu();
echo $module->loadMenu();
echo $module->loadMenu(Tools::getValue('isCms'));
die;

View File

@ -58,22 +58,6 @@ class FrontController extends FrontControllerCore
'display_footer' => $this->display_footer,
));
if (
$this->context->controller instanceof IndexController ||
$this->context->controller instanceOf PostCmsController ||
$this->context->controller instanceof PostEditoController ||
$this->context->controller instanceof HomeEditoController ||
$this->context->controller instanceof CategoryCmsController
)
{
$this->context->smarty->assign('isCms', true);
}
else
{
$this->context->smarty->assign('isCms', false);
}
$layout = $this->getLayout();
if ($layout)
{
@ -106,5 +90,27 @@ class FrontController extends FrontControllerCore
}
return true;
}
public function init()
{
if (
$this->context->controller instanceof IndexController ||
$this->context->controller instanceOf PostCmsController ||
$this->context->controller instanceof PostEditoController ||
$this->context->controller instanceof HomeEditoController ||
$this->context->controller instanceof CategoryCmsController
)
{
$this->context->isCms = 1;
$this->context->smarty->assign('isCms', 1);
}
else
{
$this->context->isCms = 0;
$this->context->smarty->assign('isCms', 0);
}
parent::init();
}
}
?>

View File

@ -23,7 +23,11 @@
<!-- Root du menu -->
{if isset($tabLink.children) && !empty($tabLink.children)}
<ul class="menu-content{if $tabLink.id_link == AdvMenuLink::ID_CMS} menu-cms{/if}{if $tabLink.id_link == AdvMenuLink::ID_BOUTIQUE} menu-boutique{/if}{if ($isCms && $tabLink.id_link == AdvMenuLink::ID_CMS) || (!$isCms && $tabLink.id_link == AdvMenuLink::ID_BOUTIQUE)} active{/if}">
<ul class="menu-content
{if $tabLink.id_link == AdvMenuLink::ID_CMS} menu-cms{/if}
{if $tabLink.id_link == AdvMenuLink::ID_BOUTIQUE} menu-boutique{/if}
{if ($isCms && $tabLink.id_link == AdvMenuLink::ID_CMS) || (!$isCms && $tabLink.id_link == AdvMenuLink::ID_BOUTIQUE)} active{/if}
">
<li class="hidden-lg hidden-md close-tab"><a href="#">{l s='Close' mod='advmenu'}<i class="fa fa-times"></i></a></li>
{foreach $tabLink.children item='rootLink' name='rootLink'}
<li class="animated">

View File

@ -1,15 +1,16 @@
<div class="load_menu"></div>
{addJsDef menuAjaxUrl=$url_ajax}
{addJsDef isCms=$isCms}
<script>
$(document).ready(function(e){
$.get(menuAjaxUrl, function( data ) {
$('.load_menu').after(data);
$('.load_menu').remove();
if(isMobile)
{
advancedDropdownMenu();
}
});
$(document).ready(function(e) {
$.ajax({
method: "POST",
url: menuAjaxUrl,
data: { isCms: isCms },
success: function(data) {
$('.load_menu').html(data);
}
})
});
</script>