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' => [
|
'result_format' => [
|
||||||
'title' => ['self', 'getFieldFromResult'],
|
'title' => ['self', 'getFieldFromResult'],
|
||||||
'title_args' => 'name',
|
'title_args' => 'name',
|
||||||
'href' => 'admin_plans.php?page=overview&action=edit&id='
|
'href' => 'admin_plans.php?page=overview&searchfield=id&searchtext='
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
// PHP configs
|
// PHP configs
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ return [
|
|||||||
'icon' => 'fa-brands fa-php',
|
'icon' => 'fa-brands fa-php',
|
||||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'overview'],
|
'self_overview' => ['section' => 'phpsettings', 'page' => 'overview'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
|
'c.id' => [
|
||||||
|
'label' => 'ID',
|
||||||
|
'field' => 'id',
|
||||||
|
],
|
||||||
'c.description' => [
|
'c.description' => [
|
||||||
'label' => lng('admin.phpsettings.description'),
|
'label' => lng('admin.phpsettings.description'),
|
||||||
'field' => 'description',
|
'field' => 'description',
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ return [
|
|||||||
'title' => lng('admin.plans.plans'),
|
'title' => lng('admin.plans.plans'),
|
||||||
'icon' => 'fa-solid fa-clipboard-list',
|
'icon' => 'fa-solid fa-clipboard-list',
|
||||||
'columns' => [
|
'columns' => [
|
||||||
|
'p.id' => [
|
||||||
|
'label' => 'ID',
|
||||||
|
'field' => 'id',
|
||||||
|
],
|
||||||
'p.name' => [
|
'p.name' => [
|
||||||
'label' => lng('admin.plans.name'),
|
'label' => lng('admin.plans.name'),
|
||||||
'field' => 'name',
|
'field' => 'name',
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ $(function() {
|
|||||||
let dropdown = $('#search .search-results');
|
let dropdown = $('#search .search-results');
|
||||||
// Hide search if query is empty
|
// Hide search if query is empty
|
||||||
if (!query.length) {
|
if (!query.length) {
|
||||||
dropdown.hide().html('');
|
dropdown.html('');
|
||||||
|
dropdown.parent().hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Show notification for short search query
|
// Show notification for short search query
|
||||||
if (query.length && query.length < 3) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
// Search
|
// Search
|
||||||
@@ -29,12 +31,14 @@ $(function() {
|
|||||||
success: data => {
|
success: data => {
|
||||||
// Show notification if we got no results
|
// Show notification if we got no results
|
||||||
if (Object.keys(data).length === 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear dropdown and show results
|
// Clear dropdown and show results
|
||||||
dropdown.show().html('');
|
dropdown.html('');
|
||||||
|
dropdown.parent().show();
|
||||||
Object.keys(data).forEach(key => {
|
Object.keys(data).forEach(key => {
|
||||||
dropdown.append('<li class="list-group-item text-muted text-capitalize">' + key + '</li>');
|
dropdown.append('<li class="list-group-item text-muted text-capitalize">' + key + '</li>');
|
||||||
data[key].forEach(item => {
|
data[key].forEach(item => {
|
||||||
@@ -44,7 +48,8 @@ $(function() {
|
|||||||
},
|
},
|
||||||
error: function (a, b) {
|
error: function (a, b) {
|
||||||
console.log(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;
|
border-radius: 0 0 $border-radius $border-radius;
|
||||||
|
|
||||||
.search-results {
|
.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) **/
|
max-height: calc(50vh - 2px); /** same as .search-results-box - border (top/bottom) **/
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
<i class="fa fa-search text-muted"></i>
|
<i class="fa fa-search text-muted"></i>
|
||||||
<input title="search" type="search" class="search-input" placeholder="Search for ...">
|
<input title="search" type="search" class="search-input" placeholder="Search for ...">
|
||||||
</div>
|
</div>
|
||||||
<div class="search-results-box">
|
<div class="search-results-box" style="display:none;">
|
||||||
<div class="search-results list-group-flush" style="display: none"></div>
|
<div class="search-results list-group-flush"></div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<ul class="navbar-nav ms-auto">
|
<ul class="navbar-nav ms-auto">
|
||||||
|
|||||||
Reference in New Issue
Block a user