chg: [navbar:search-all] Fixed dropdown instantiation

pull/72/head
mokaddem 2021-09-17 18:53:32 +02:00
parent cf3e87614e
commit 24a8aa42c8
2 changed files with 6 additions and 4 deletions

View File

@ -4,10 +4,12 @@
<input type="text" class="form-control d-inline-block" id="globalSearch" placeholder="<?= __('Search in Cerebrate...') ?>"> <input type="text" class="form-control d-inline-block" id="globalSearch" placeholder="<?= __('Search in Cerebrate...') ?>">
<i class="icon <?= $this->FontAwesome->getClass('search') ?>"></i> <i class="icon <?= $this->FontAwesome->getClass('search') ?>"></i>
</span> </span>
<div class="dropdown">
<button type="button" class="dropdown-toggle d-none" id="dropdownMenuSearchAll" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"></button> <button type="button" class="dropdown-toggle d-none" id="dropdownMenuSearchAll" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"></button>
<div class="global-search-result-container dropdown-menu dropdown-menu-end p-0 pt-2" aria-labelledby="dropdownMenuSearchAll"> <div class="global-search-result-container dropdown-menu dropdown-menu-end p-0 pt-2" aria-labelledby="dropdownMenuSearchAll">
</div> </div>
</div> </div>
</div>
<div class="header-menu d-flex ms-1"> <div class="header-menu d-flex ms-1">
<?= $this->element('layouts/header/header-notifications') ?> <?= $this->element('layouts/header/header-notifications') ?>
<?= $this->element('layouts/header/header-profile') ?> <?= $this->element('layouts/header/header-profile') ?>

View File

@ -128,7 +128,7 @@ function performGlobalSearch(evt) {
return; return;
} }
if (value.length < 3 && evt.keyCode != 13) { if (value.length < 3 && evt.keyCode != 13) {
bootstrap.Popover.getInstance('#dropdownMenuSearchAll').hide() bootstrap.Dropdown.getOrCreateInstance('#dropdownMenuSearchAll').hide()
return; return;
} }
const endpoint = '/instance/searchAll' const endpoint = '/instance/searchAll'
@ -138,7 +138,7 @@ function performGlobalSearch(evt) {
statusNode: $resultContainer statusNode: $resultContainer
} }
bootstrap.Popover.getInstance('#dropdownMenuSearchAll').show() bootstrap.Dropdown.getOrCreateInstance('#dropdownMenuSearchAll').show()
AJAXApi.quickFetchURL(url, options).then((theHTML) => { AJAXApi.quickFetchURL(url, options).then((theHTML) => {
$resultContainer.html(theHTML) $resultContainer.html(theHTML)
}) })