Przeglądaj źródła

Ticket #3701 - Lucid: Main menu is overlapped with Toolbar menu.

AntonLV 4 lat temu
rodzic
commit
157cb573f4

+ 1 - 0
modules/boonex/lucid/data/template/system/scripts/BxTemplMenuSite.php

@@ -26,6 +26,7 @@ class BxTemplMenuSite extends BxTemplMenuMoreAuto
         $this->_oModule = BxDolModule::getInstance($this->_sModule);
         $this->_oModule = BxDolModule::getInstance($this->_sModule);
 
 
         $this->_sJsClassMoreAuto = 'BxLucidMenuMoreAuto';
         $this->_sJsClassMoreAuto = 'BxLucidMenuMoreAuto';
+        $this->_sJsCallMoreAuto = "if(!{js_object}) {var {js_object} = new {js_class}({js_params}); $(document).ready(function() {{js_object}.init();});}";
 
 
         $this->_bSiteMenu = $this->_sObject == 'sys_site';
         $this->_bSiteMenu = $this->_sObject == 'sys_site';
         $this->_bSiteMenuSubmenu = false;
         $this->_bSiteMenuSubmenu = false;

+ 15 - 13
template/scripts/BxBaseMenuMoreAuto.php

@@ -21,9 +21,10 @@ class BxBaseMenuMoreAuto extends BxTemplMenu
     protected $_bMoreAuto;
     protected $_bMoreAuto;
     protected $_iMoreAutoItemsStatic;
     protected $_iMoreAutoItemsStatic;
     protected $_bMoreAutoItemsStaticOnly;
     protected $_bMoreAutoItemsStaticOnly;
-    
+
     protected $_sJsClassMoreAuto;
     protected $_sJsClassMoreAuto;
     protected $_sJsObjectMoreAuto;
     protected $_sJsObjectMoreAuto;
+    protected $_sJsCallMoreAuto;
 
 
     protected $_aHtmlIds;
     protected $_aHtmlIds;
 
 
@@ -37,9 +38,10 @@ class BxBaseMenuMoreAuto extends BxTemplMenu
         $this->_bMoreAuto = null;
         $this->_bMoreAuto = null;
         $this->_iMoreAutoItemsStatic = 1;
         $this->_iMoreAutoItemsStatic = 1;
         $this->_bMoreAutoItemsStaticOnly = false;
         $this->_bMoreAutoItemsStaticOnly = false;
-        
+
         $this->_sJsClassMoreAuto = 'BxDolMenuMoreAuto';
         $this->_sJsClassMoreAuto = 'BxDolMenuMoreAuto';
         $this->_sJsObjectMoreAuto = 'oMenuMoreAuto' . bx_gen_method_name($this->_sObject);
         $this->_sJsObjectMoreAuto = 'oMenuMoreAuto' . bx_gen_method_name($this->_sObject);
+        $this->_sJsCallMoreAuto = "if(!{js_object}) {var {js_object} = new {js_class}({js_params}); {js_object}.init();}";
 
 
         $sPrefix = str_replace('_', '-', $this->_sObject);
         $sPrefix = str_replace('_', '-', $this->_sObject);
         $this->_aHtmlIds = array(
         $this->_aHtmlIds = array(
@@ -98,18 +100,18 @@ class BxBaseMenuMoreAuto extends BxTemplMenu
 
 
     protected function _getJsCodeMoreAuto()
     protected function _getJsCodeMoreAuto()
     {
     {
-        $sJsClass = $this->_getJsClassMoreAuto();
-        $sJsObject = $this->_getJsObjectMoreAuto();
-        $aJsParams = array(
-            'sObject' => $this->_sObject,
-            'iItemsStatic' => $this->_iMoreAutoItemsStatic,
-            'bItemsStaticOnly' => $this->_bMoreAutoItemsStaticOnly ? 1 : 0,
-            'aHtmlIds' => $this->_getHtmlIds()
-        );
-
-        return $this->_oTemplate->_wrapInTagJsCode("if(!" . $sJsObject . ") {var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aJsParams) . "); " . $sJsObject . ".init();}");
+        return $this->_oTemplate->_wrapInTagJsCode(bx_replace_markers($this->_sJsCallMoreAuto, [
+            'js_class' => $this->_getJsClassMoreAuto(),
+            'js_object' => $this->_getJsObjectMoreAuto(),
+            'js_params' => json_encode([
+                'sObject' => $this->_sObject,
+                'iItemsStatic' => $this->_iMoreAutoItemsStatic,
+                'bItemsStaticOnly' => $this->_bMoreAutoItemsStaticOnly ? 1 : 0,
+                'aHtmlIds' => $this->_getHtmlIds()
+            ])
+        ]));
     }
     }
-    
+
     protected function _getMenuItem ($aItem)
     protected function _getMenuItem ($aItem)
     {
     {
         $aItem['popup'] = '';
         $aItem['popup'] = '';