adjust css/js of global-search; added missing id fields for searchable entities
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -187,7 +187,7 @@ class GlobalSearch
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'name',
|
||||
'href' => 'admin_plans.php?page=overview&action=edit&id='
|
||||
'href' => 'admin_plans.php?page=overview&searchfield=id&searchtext='
|
||||
]
|
||||
],
|
||||
// PHP configs
|
||||
|
||||
@@ -34,6 +34,10 @@ return [
|
||||
'icon' => 'fa-brands fa-php',
|
||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'overview'],
|
||||
'columns' => [
|
||||
'c.id' => [
|
||||
'label' => 'ID',
|
||||
'field' => 'id',
|
||||
],
|
||||
'c.description' => [
|
||||
'label' => lng('admin.phpsettings.description'),
|
||||
'field' => 'description',
|
||||
|
||||
@@ -31,6 +31,10 @@ return [
|
||||
'title' => lng('admin.plans.plans'),
|
||||
'icon' => 'fa-solid fa-clipboard-list',
|
||||
'columns' => [
|
||||
'p.id' => [
|
||||
'label' => 'ID',
|
||||
'field' => 'id',
|
||||
],
|
||||
'p.name' => [
|
||||
'label' => lng('admin.plans.name'),
|
||||
'field' => 'name',
|
||||
|
||||
@@ -10,12 +10,14 @@ $(function() {
|
||||
let dropdown = $('#search .search-results');
|
||||
// Hide search if query is empty
|
||||
if (!query.length) {
|
||||
dropdown.hide().html('');
|
||||
dropdown.html('');
|
||||
dropdown.parent().hide();
|
||||
return;
|
||||
}
|
||||
// Show notification for short search query
|
||||
if (query.length && query.length < 3) {
|
||||
dropdown.show().html('<li class="list-group-item text-muted">Please enter more than 2 characters</li>');
|
||||
dropdown.html('<li class="list-group-item text-muted">Please enter more than 2 characters</li>');
|
||||
dropdown.parent().show();
|
||||
return;
|
||||
}
|
||||
// Search
|
||||
@@ -29,12 +31,14 @@ $(function() {
|
||||
success: data => {
|
||||
// Show notification if we got no results
|
||||
if (Object.keys(data).length === 0) {
|
||||
dropdown.show().html('<li class="list-group-item text-muted">Nothing found!</li>');
|
||||
dropdown.html('<li class="list-group-item text-muted">Nothing found!</li>');
|
||||
dropdown.parent().show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear dropdown and show results
|
||||
dropdown.show().html('');
|
||||
dropdown.html('');
|
||||
dropdown.parent().show();
|
||||
Object.keys(data).forEach(key => {
|
||||
dropdown.append('<li class="list-group-item text-muted text-capitalize">' + key + '</li>');
|
||||
data[key].forEach(item => {
|
||||
@@ -44,7 +48,8 @@ $(function() {
|
||||
},
|
||||
error: function (a, b) {
|
||||
console.log(a, b);
|
||||
dropdown.show().html('<li class="list-group-item text-muted">Whoops we got some errors!</li>');
|
||||
dropdown.html('<li class="list-group-item text-muted">Whoops we got some errors!</li>');
|
||||
dropdown.parent().show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
border-radius: 0 0 $border-radius $border-radius;
|
||||
|
||||
.search-results {
|
||||
width: 70vh; /** same as .search-results-box **/
|
||||
width: 100%; /** same as .search-results-box **/
|
||||
max-height: calc(50vh - 2px); /** same as .search-results-box - border (top/bottom) **/
|
||||
overflow: auto;
|
||||
border-radius: $border-radius;
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
<i class="fa fa-search text-muted"></i>
|
||||
<input title="search" type="search" class="search-input" placeholder="Search for ...">
|
||||
</div>
|
||||
<div class="search-results-box">
|
||||
<div class="search-results list-group-flush" style="display: none"></div>
|
||||
<div class="search-results-box" style="display:none;">
|
||||
<div class="search-results list-group-flush"></div>
|
||||
</div>
|
||||
</form>
|
||||
<ul class="navbar-nav ms-auto">
|
||||
|
||||
Reference in New Issue
Block a user