Skip to content

Commit

Permalink
add tooltip for search_help_text & hide filter btn if there is no fil…
Browse files Browse the repository at this point in the history
…ter fields
  • Loading branch information
yaghoubi committed Dec 24, 2024
1 parent c70a4ed commit 95b6747
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion django_daisy/static/admin/css/base_tailwind.css

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions django_daisy/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@
{% if active_filters_count %}
<span class="indicator-item badge badge-info">{{ active_filters_count }}</span>
{% endif %}
<button type="button" id="open-filter-drawer"
class="btn btn-sm btn-primary drawer-button">
<i class="fa fa-filter"></i>
</button>
{% if cl.list_filter %}
<button type="button" id="open-filter-drawer"
class="btn btn-sm btn-primary drawer-button">
<i class="fa fa-filter"></i>
</button>
{% endif %}
</div>
{% endblock %}
</div>
Expand All @@ -132,7 +134,8 @@
</div>
{% if cl.has_filters %}
<!-- Filter section -->
<div id="changelist-filter" class="drawer-side {% if SHOW_CHANGELIST_FILTER %} mt-3 lg:ms-2 card-bordered {% endif %} !overflow-visible z-10 h-full">
<div id="changelist-filter"
class="drawer-side {% if SHOW_CHANGELIST_FILTER %} mt-3 lg:ms-2 card-bordered {% endif %} !overflow-visible z-10 h-full">
<label for="filter-drawer" aria-label="close sidebar" class="drawer-overlay"></label>

<div class="card-body p-3 bg-base-100 w-80 h-full">
Expand Down
16 changes: 10 additions & 6 deletions django_daisy/templates/admin/search_form.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% load i18n static %}
{% if cl.search_fields %}

<div class="inline-flex items-center sm:w-80 w-full">
<div id="changelist-search" role="search" class="flex items-center w-full" >
<div class="form-control flex flex-row items-center rounded-sm border border-base-content/20 ps-3 w-full">
<div class=" items-center sm:w-80 w-full">

<div data-tip="{{ cl.search_help_text }}" id="changelist-search" role="search" class="flex tooltip tooltip-bottom items-center w-full">
<div class="form-control flex flex-row items-center rounded-sm border border-base-content/20 ps-3 w-full">
<label for="searchbar" class="flex items-center">
<i class="fa fa-search text-gray-400"></i>
</label>
Expand All @@ -13,7 +14,11 @@
name="{{ search_var }}"
value="{{ cl.query }}"
id="searchbar"
{% if cl.search_help_text %}
placeholder="{{ cl.search_help_text }}"
{% else %}
placeholder="{% trans "Search along" %} {{ cl.opts.verbose_name_plural }}"
{% endif %}
class="input w-full border-0 focus:border-transparent focus:outline-0 transition-all input-sm focus:outline-offset-0"
{% if cl.search_help_text %} aria-describedby="searchbar_helptext"{% endif %}
>
Expand All @@ -25,10 +30,9 @@
<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}">
{% endif %}
{% endfor %}
{% if cl.search_help_text %}
<div class="help mt-2" id="searchbar_helptext">{{ cl.search_help_text }}</div>
{% endif %}

</div>

</div>

{% endif %}

0 comments on commit 95b6747

Please sign in to comment.