Skip to content

Commit

Permalink
Ticket #4786 - Artificer: Add setting to hide search bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Sep 3, 2024
1 parent 4ea62d6 commit 271664f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@ public function TemplPageAddComponent($sKey)
$mixedResult = parent::TemplPageAddComponent($sKey);
break;

case 'sys_site_search':
$oSearch = new BxTemplSearch();
$oSearch->setLiveSearch(true);
$mixedResult = $oSearch->getForm(BX_DB_PADDING_DEF, false, true) . $oSearch->getResultsContainer();
case 'sys_toolbar_search':
if(getParam('bx_artificer_header_search') == 'on')
$mixedResult = parent::TemplPageAddComponent($sKey);
else
$mixedResult = '';
break;

default:
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/artificer/install/langs/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string name="_bx_artificer_stg_cpt_option_switcher_name"><![CDATA[Name in Template Switcher]]></string>
<string name="_bx_artificer_stg_cpt_option_page_width"><![CDATA[Page Width]]></string>
<string name="_bx_artificer_stg_cpt_option_header_stretched"><![CDATA[Stretched Header]]></string>
<string name="_bx_artificer_stg_cpt_option_header_search"><![CDATA[Enable floating search bar]]></string>
<string name="_bx_artificer_stg_cpt_option_color_scheme"><![CDATA[Color Scheme]]></string>
<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>
Expand Down
11 changes: 7 additions & 4 deletions modules/boonex/artificer/install/sql/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ SET @iCategoryId = LAST_INSERT_ID();

INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
(@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, '_use_htmx'), '_bx_artificer_stg_cpt_option_use_htmx', '', 'checkbox', '', '', '', 5);
(@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";}', '', '', 2),

(@iCategoryId, CONCAT(@sName, '_page_width'), '_bx_artificer_stg_cpt_option_page_width', '1280', 'digit', '', '', '', 10),
(@iCategoryId, CONCAT(@sName, '_header_stretched'), '_bx_artificer_stg_cpt_option_header_stretched', '', 'checkbox', '', '', '', 11),
(@iCategoryId, CONCAT(@sName, '_header_search'), '_bx_artificer_stg_cpt_option_header_search', 'on', 'checkbox', '', '', '', 12),

(@iCategoryId, CONCAT(@sName, '_use_htmx'), '_bx_artificer_stg_cpt_option_use_htmx', '', 'checkbox', '', '', '', 30);

-- SETTINGS: Artificer template Custom Styles
INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/russian/data/langs/bx_artificer/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string name="_bx_artificer_stg_cpt_option_switcher_name"><![CDATA[Название в переключателе тем]]></string>
<string name="_bx_artificer_stg_cpt_option_page_width"><![CDATA[Ширина страницы]]></string>
<string name="_bx_artificer_stg_cpt_option_header_stretched"><![CDATA[Растянутый заголовок]]></string>
<string name="_bx_artificer_stg_cpt_option_header_search"><![CDATA[Включить плавающую панель поиска]]></string>
<string name="_bx_artificer_stg_cpt_option_color_scheme"><![CDATA[Цветовая схема]]></string>
<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>
Expand Down
13 changes: 1 addition & 12 deletions template/_page_toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,7 @@
</div>
<!-- Search -->
<div class="bx-toolbar-item bx-ti-search flex-1 lg:flex-none flex items-center justify-end">
<div class="bx-ti-search-box flex-auto flex items-start md:min-w-88 mr-2 bg-white/95 dark:bg-gray-800/95 rounded-md shadow-md hidden">
<div class="relative w-full">__sys_site_search__</div>
</div>
<div class="bx-ti-search-button group relative inline-flex items-center mx-2 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 text-base font-medium leading-6 border border-transparent hover:border-gray-200/50 active:border-gray-300 dark:hover:border-gray-700/50 dark:active:border-gray-700 bg-gray-100 dark:bg-gray-700/50 active:bg-gray-300 dark:active:bg-black/50 hover:bg-gray-200/50 dark:hover:bg-gray-700/50 rounded-full">
<a href="javascript:void(0)" onclick="javascript:bx_site_search_show(this)">
<span class="relative flex items-center justify-center h-10 w-10">
<div class="bx-icon">
<bx_image_auto:search />
</div>
</span>
</a>
</div>
__sys_toolbar_search__
</div>
</div>
<!-- Members Toolbar -->
Expand Down
12 changes: 12 additions & 0 deletions template/_page_toolbar_search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="bx-ti-search-box flex-auto flex items-start md:min-w-88 mr-2 bg-white/95 dark:bg-gray-800/95 rounded-md shadow-md hidden">
<div class="relative w-full">__sys_site_search__</div>
</div>
<div class="bx-ti-search-button group relative inline-flex items-center mx-2 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 text-base font-medium leading-6 border border-transparent hover:border-gray-200/50 active:border-gray-300 dark:hover:border-gray-700/50 dark:active:border-gray-700 bg-gray-100 dark:bg-gray-700/50 active:bg-gray-300 dark:active:bg-black/50 hover:bg-gray-200/50 dark:hover:bg-gray-700/50 rounded-full">
<a href="javascript:void(0)" onclick="javascript:bx_site_search_show(this)">
<span class="relative flex items-center justify-center h-10 w-10">
<div class="bx-icon">
<bx_image_auto:search />
</div>
</span>
</a>
</div>
9 changes: 9 additions & 0 deletions template/scripts/BxBaseFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ function TemplPageAddComponent($sKey)
case 'sys_header_width':
$mixedResult = 'bx-def-page-width';
break;

case 'sys_toolbar_search':
$oSearch = new BxTemplSearch();
$oSearch->setLiveSearch(true);

$mixedResult = $this->_oTemplate->parseHtmlByName('_page_toolbar_search.html', [
'sys_site_search' => $oSearch->getForm(BX_DB_PADDING_DEF, false, true) . $oSearch->getResultsContainer()
]);
break;
}

return $mixedResult;
Expand Down

0 comments on commit 271664f

Please sign in to comment.