Pārlūkot izejas kodu

Ticket #4641 - Use HTMX to load page content without genaral page structure. Enable/disable setting.

AntonLV 2 gadi atpakaļ
vecāks
revīzija
0e859fa6f5

+ 4 - 6
modules/boonex/artificer/data/template/system/scripts/BxTemplMenu.php

@@ -19,9 +19,9 @@ class BxTemplMenu extends BxBaseMenu
         if(isset($aObject['object'])) {
             //--- For page submenus ---//
             if(strpos($aObject['object'], '_submenu') !== false) {
-                $this->_bHx = true;
-                $this->_bHxHead = true;
-                $this->_mHxPreload = true;
+                $this->_bHx = getParam('bx_artificer_use_htmx') == 'on';
+                $this->_bHxHead = $this->_bHx && true;
+                $this->_mHxPreload = $this->_bHx && true;
                 $this->_aHx = [
                     'get' => '',
                     'trigger' => 'click',
@@ -40,9 +40,7 @@ class BxTemplMenu extends BxBaseMenu
 
                 $sInjection = '';
                 if(($sExtensions = trim($sExtensions)) != '')
-                    $sInjection = 'hx-ext="' . $sExtensions . '"';
-
-                $this->_oTemplate->addInjection('injection_body', 'text', $sInjection);
+                    $this->_oTemplate->addInjection('injection_body', 'text', 'hx-ext="' . $sExtensions . '"');
             }
         }
 

+ 4 - 4
modules/boonex/artificer/data/template/system/scripts/BxTemplMenuSite.php

@@ -35,11 +35,11 @@ class BxTemplMenuSite extends BxTemplMenuMoreAuto
         $this->_bSiteMenu = $this->_sObject == 'sys_site';
         $this->_bSiteMenuInPanel = $this->_sObject == 'sys_site_in_panel';
         $this->_bApplicationMenu = $this->_sObject == 'sys_application';
-        
+
         if($this->_bSiteMenu) {
-            $this->_bHx = true;
-            $this->_bHxHead = true;
-            $this->_mHxPreload = true;
+            $this->_bHx = getParam('bx_artificer_use_htmx') == 'on';
+            $this->_bHxHead = $this->_bHx && true;
+            $this->_mHxPreload = $this->_bHx && true;
             $this->_aHx = [
                 'get' => '',
                 'trigger' => 'click',

+ 2 - 0
modules/boonex/artificer/install/langs/en.xml

@@ -13,6 +13,8 @@
     <string name="_bx_artificer_stg_cpt_option_color_scheme_auto"><![CDATA[Auto with switcher]]></string>
     <string name="_bx_artificer_stg_cpt_option_color_scheme_light_only"><![CDATA[Light mode only]]></string>
     <string name="_bx_artificer_stg_cpt_option_color_scheme_dark_only"><![CDATA[Dark mode only]]></string>
+    <string name="_bx_artificer_stg_cpt_option_use_htmx"><![CDATA[Use HTMX in Top menu and Page submenu (experimental)]]></string>
+    
 
     <string name="_bx_artificer_stg_cpt_category_styles_custom"><![CDATA[Custom Styles]]></string>
     <string name="_bx_artificer_stg_cpt_option_styles_custom"><![CDATA[Custom Styles]]></string>

+ 2 - 1
modules/boonex/artificer/install/sql/install.sql

@@ -15,7 +15,8 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, CONCAT(@sName, '_switcher_title'), '_bx_artificer_stg_cpt_option_switcher_name', 'Artificer', 'digit', '', '', '', 1), 
 (@iCategoryId, CONCAT(@sName, '_page_width'), '_bx_artificer_stg_cpt_option_page_width', '1280', 'digit', '', '', '', 2),
 (@iCategoryId, CONCAT(@sName, '_header_stretched'), '_bx_artificer_stg_cpt_option_header_stretched', '', 'checkbox', '', '', '', 3),
-(@iCategoryId, CONCAT(@sName, '_color_scheme'), '_bx_artificer_stg_cpt_option_color_scheme', 'auto', 'select', 'a:2:{s:6:"module";s:12:"bx_artificer";s:6:"method";s:24:"get_options_color_scheme";}', '', '', 4);
+(@iCategoryId, CONCAT(@sName, '_color_scheme'), '_bx_artificer_stg_cpt_option_color_scheme', 'auto', 'select', 'a:2:{s:6:"module";s:12:"bx_artificer";s:6:"method";s:24:"get_options_color_scheme";}', '', '', 4),
+(@iCategoryId, CONCAT(@sName, '_use_htmx'), '_bx_artificer_stg_cpt_option_use_htmx', '', 'checkbox', '', '', '', 5);
 
 -- SETTINGS: Artificer template Custom Styles
 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 

+ 1 - 0
modules/boonex/russian/data/langs/bx_artificer/ru.xml

@@ -13,6 +13,7 @@
     <string name="_bx_artificer_stg_cpt_option_color_scheme_auto"><![CDATA[Авто с переключателем]]></string>
     <string name="_bx_artificer_stg_cpt_option_color_scheme_light_only"><![CDATA[Только светлый режим]]></string>
     <string name="_bx_artificer_stg_cpt_option_color_scheme_dark_only"><![CDATA[Только темный режим]]></string>
+    <string name="_bx_artificer_stg_cpt_option_use_htmx"><![CDATA[Использовать HTMX в верхнем меню и подменю страницы (экспериментально)]]></string>
 
     <string name="_bx_artificer_stg_cpt_category_styles_custom"><![CDATA[Пользовательские стили]]></string>
     <string name="_bx_artificer_stg_cpt_option_styles_custom"><![CDATA[Пользовательские стили]]></string>