Commit 9e06b8c5 authored by Florian Peters's avatar Florian Peters Committed by Andreas Fernandez
Browse files

[CLEANUP] Streamline toggle search toolbox

Remove the toggle functionality from the HTML template and use
jQuery + require.js for page and list.

Resolves: #69500
Releases: master
Change-Id: I815239acdf74e94c4f0af3a74aacab565c8f5d03
Reviewed-on: http://review.typo3.org/42997

Reviewed-by: Alexander Opitz's avatarAlexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz's avatarAlexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
parent 282f9fcb
......@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
......@@ -1079,7 +1080,8 @@ class PageLayoutController {
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && !empty($tableOutput)) {
$this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'.IconUtility::getSpriteIcon('apps-toolbar-menu-search').'</a>';
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ToggleSearchToolbox');
$this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" class="t3js-toggle-search-toolbox" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'.IconUtility::getSpriteIcon('apps-toolbar-menu-search') . '</a>';
$this->markers['SEARCHBOX'] = $dbList->getSearchBox(0);
}
// Additional footer content
......@@ -1438,4 +1440,12 @@ class PageLayoutController {
return $GLOBALS['TYPO3_DB'];
}
/**
* Returns current PageRenderer
*
* @return PageRenderer
*/
protected function getPageRenderer() {
return GeneralUtility::makeInstance(PageRenderer::class);
}
}
......@@ -11,15 +11,6 @@
</div>
###SEARCHBOX###
</div>
<script>
function toggleSearchToolbox() {
if (document.getElementById('db_list-searchbox-toolbar').style.display == 'none') {
document.getElementById('db_list-searchbox-toolbar').style.display = 'block';
} else {
document.getElementById('db_list-searchbox-toolbar').style.display = 'none';
}
}
</script>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
###CONTENT###
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
define('TYPO3/CMS/Backend/ToggleSearchToolbox', ['jquery'], function($) {
$(document).ready(function() {
$('.t3js-toggle-search-toolbox').on('click', function() {
$('#db_list-searchbox-toolbar').toggle();
});
});
});
......@@ -541,9 +541,8 @@ class RecordList {
// searchbox toolbar
if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || !empty($dblist->searchString))) {
$markers['SEARCHBOX'] = $dblist->getSearchBox();
$markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="'
. $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'
. IconUtility::getSpriteIcon('apps-toolbar-menu-search').'</a>';
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ToggleSearchToolbox');
$markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" class="t3js-toggle-search-toolbox" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">' . IconUtility::getSpriteIcon('apps-toolbar-menu-search') . '</a>';
}
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
......
......@@ -11,15 +11,6 @@
</div>
###SEARCHBOX###
</div>
<script>
function toggleSearchToolbox() {
if (document.getElementById('db_list-searchbox-toolbar').style.display == 'none') {
document.getElementById('db_list-searchbox-toolbar').style.display = 'block';
} else {
document.getElementById('db_list-searchbox-toolbar').style.display = 'none';
}
}
</script>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
###CONTENT###
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment