Skip to content

Commit

Permalink
Ticket #4641 - Use HTMX to load page content without genaral page str…
Browse files Browse the repository at this point in the history
…ucture.
  • Loading branch information
AntonLV committed Mar 15, 2024
1 parent 499fd1c commit 3015d16
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
3 changes: 2 additions & 1 deletion inc/classes/BxDolTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
define('BX_PAGE_CONTENT_PRELOAD', 50); ///< page content preload for dynamic (htmx) loading
define('BX_PAGE_CONTENT_WITH_COVER', 54); ///< page content with cover and submenu for dynamic (htmx) loading
define('BX_PAGE_CONTENT_WITH_SUBMENU', 56); ///< page content with submenu for dynamic (htmx) loading
define('BX_PAGE_CONTENT', 58); ///< page content only for dynamic (htmx) loading
define('BX_PAGE_TRANSITION', 150); ///< transition page with redirect to display some msg, like 'please wait', without headers footers

/**
Expand Down Expand Up @@ -754,7 +755,7 @@ function setPageNameIndexByTarget($s)
break;

case 'bx-content-wrapper':
//$i = 58;
$i = BX_PAGE_CONTENT;
break;
}

Expand Down
6 changes: 2 additions & 4 deletions modules/base/text/classes/BxBaseModTextModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ public function serviceGetSafeServices()

public function serviceManageTools($sType = 'common')
{
$sResult = parent::serviceManageTools($sType);
if(!empty($sResult))
$this->_oTemplate->addJsSystem(['modules/base/text/js/|manage_tools.js']);
$this->_oTemplate->addJs(['modules/base/text/js/|manage_tools.js']);

return $sResult;
return parent::serviceManageTools($sType);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions modules/boonex/artificer/data/template/system/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ import url(../../../../../../../template/css/general.css);
}


/*--- Page Content ---*/
#bx-content-wrapper {
opacity: 1;
transition: opacity 200ms ease-out;
}
#bx-content-wrapper.htmx-added {
opacity: 0;
}


/*--- Profile Avatar ---*/
.bx-db-content.bx-content-padding-block .bx-profile-avatar-cnt {
margin-left: -0.25rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ public function __construct ($aObject, $oTemplate = false)
if(isset($aObject['object'])) {
//--- For page submenus ---//
if(strpos($aObject['object'], '_submenu') !== false && !($this instanceof BxBaseModProfileMenuView)) {
$sClass = 'bx-menu-tab-active';

$this->_bHx = true;
$this->_aHx = [
'get' => '',
'trigger' => 'click',
'target' => '#bx-content-with-submenu-wrapper',
'swap' => 'outerHTML',
'replace-url' => 'true'
'target' => '#bx-content-wrapper',
'swap' => 'outerHTML settle:200ms',
'replace-url' => 'true',
'on:htmx-after-on-load' => 'jQuery(this).parent().addClass(\'' . $sClass . '\').siblings().removeClass(\'' . $sClass . '\');'
];

$this->_oTemplate->addInjection('injection_body', 'text', 'hx-on::after-request="jQuery(this).bxProcessHtml()"');
Expand Down
5 changes: 5 additions & 0 deletions template/page_58.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div id="bx-content-wrapper">
<bx_include_auto:_page_content_beg.html />
__page_main_code__
<bx_include_auto:_page_content_end.html />
</div>

0 comments on commit 3015d16

Please sign in to comment.