Skip to content

Commit 84c8273

Browse files
authored
Fix criteria filter button UI (#19743)
* fix criteria filter button UI * more spacing * force change search button style * use parameter to indicate context
1 parent 032a61c commit 84c8273

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/Glpi/Search/Input/QueryBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static function showGenericSearch($itemtype, array $params)
8585
$p['showmassiveactions'] = true;
8686
$p['extra_actions_templates'] = [];
8787
$p['hide_criteria'] = $params['hide_criteria'] ?? false;
88+
$p['is_criteria_filter'] = $params['is_criteria_filter'] ?? false;
8889

8990
foreach ($params as $key => $val) {
9091
$p[$key] = $val;

templates/components/search/criteria_filter.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<div id="manage_filter_ux" class="{{ filter_enabled ? "" : "d-none" }}">
4545

4646
{# Display search UX #}
47-
{% do call('Glpi\\Search\\Input\\QueryBuilder::showGenericSearch', [itemtype, params]) %}
47+
{% do call('Glpi\\Search\\Input\\QueryBuilder::showGenericSearch', [itemtype, params + {is_criteria_filter: true}]) %}
4848

4949
{# Display search results, hidden until a search is executed #}
5050
<div id="criteria_filter_preview" class="d-none">

templates/components/search/criteria_filter_actions.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
# ---------------------------------------------------------------------
3131
#}
3232

33-
<div>
33+
<div class="ms-2">
3434
<button
35-
class="btn btn-sm btn-primary me-1 {{ show_save ? "" : "d-none" }}"
35+
class="btn btn-primary me-1 {{ show_save ? "" : "d-none" }}"
3636
type="submit"
3737
name="save_filters"
3838
>
@@ -42,7 +42,7 @@
4242
</button>
4343

4444
<button
45-
class="btn btn-sm btn-outline-danger me-1 {{ show_delete ? "" : "d-none" }}"
45+
class="btn btn-outline-danger me-1 {{ show_delete ? "" : "d-none" }}"
4646
name="delete_filters"
4747
>
4848
<i class="ti ti-trash"></i>

templates/components/search/query_builder/main.html.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@
116116
<span class="d-none d-sm-block">{{ __('group') }}</span>
117117
</button>
118118
{% if mainform %}
119-
<span class="ms-auto btn-group">
119+
{% set action_count = showaction + p['showbookmark'] + p['showreset'] %}
120+
<span class="ms-auto {{ action_count > 1 ? 'btn-group' : '' }}">
120121
{% if (showaction) %}
121122
{# Display submit button #}
122-
<button class="btn btn-sm btn-primary" type="button" name="{{ p['actionname'] }}">
123+
<button class="btn {{ p['is_criteria_filter'] ? 'btn-ghost-secondary' : 'btn-sm btn-primary' }}" type="button" name="{{ p['actionname'] }}">
123124
<i class="ti ti-search"></i>
124125
<span class="d-none d-sm-block">{{ p['actionvalue'] }}</span>
125126
</button>

0 commit comments

Comments
 (0)