Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 57 additions & 48 deletions django_daisy/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,58 @@
{% endif %}

<!-- Start of drawer component -->
<div class="drawer drawer-end {% if SHOW_CHANGELIST_FILTER %} xl:drawer-open {% endif %} ">
<div class="{%if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} {% else %}drawer drawer-end {% endif %} {% if SHOW_CHANGELIST_FILTER %} xl:drawer-open {% endif %} ">
<input id="filter-drawer" type="checkbox" class="drawer-toggle"/>
{% 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">
<label for="filter-drawer" aria-label="close sidebar" class="drawer-overlay"></label>

<div class="bg-base-100 h-full {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} w-full flex flex-wrap gap-2{% else %} card-body p-3 w-80 {% endif %}">
<div class="card-header flex justify-between {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} p-3 {% else %} p-2{% endif %}">
{% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %}{% else %}<h2 class="font-bold">{% translate 'Filter' %}</h2>{% endif %}
<button id="apply-filter" type="button"
class="btn btn-sm btn-primary">{% trans "Filter" %}</button>
</div>
{% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %}
{% else %}
{% if cl.is_facets_optional or active_filters_count %}
<div id="changelist-filter-extra-actions" class="mb-2 flex justify-between">
{% if cl.is_facets_optional %}
<div class="form-control">
{% if cl.add_facets %}
<label class="label cursor-pointer text-sm">
<span class="label-text text-sm pe-2">{% translate "Show counts" %}</span>
<input checked value="{{ cl.remove_facet_link }}" type="checkbox"
class="toggle toggle-sm filter_show_count"/>
</label>
{% else %}
<label class="label cursor-pointer">
<span class="label-text pe-2">{% translate "Show counts" %}</span>
<input value="{{ cl.add_facet_link }}" type="checkbox"
class="toggle toggle-sm filter_show_count"/>
</label>
{% endif %}
</div>
{% endif %}
{% if active_filters_count %}
<h3 class="pt-1">
<a href="?"
class="link text-sm">
<i class="fa fa-times text-error"></i>
{% translate "Clear all filters" %}</a>
</h3>
{% endif %}
</div>
{% endif %}
{% endif %}
{% for spec in cl.filter_specs %}
{% admin_list_filter cl spec request %}
{% endfor %}
</div>
</div>
{% endif %}
<!-- Main content section -->
<div class="drawer-content flex flex-col w-full h-full">
<div id="content-main" class="overflow-hidden mt-3 w-full h-full flex">
Expand All @@ -83,6 +132,7 @@
{% if action_form and actions_on_top and cl.show_admin_actions %}
{% admin_actions %}
{% endif %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
<div class="object-tools inline-flex ms-auto flex-wrap max-md:justify-center gap-2 justify-between p-4 pe-1">
{% block object-tools %}
{% if cl.list_editable %}
Expand Down Expand Up @@ -116,53 +166,6 @@

</div>
</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">
<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">
<div class="card-header flex justify-between p-2">
<h2 class="font-bold">{% translate 'Filter' %}</h2>
<button id="apply-filter" type="button"
class="btn btn-sm btn-primary">{% trans "Filter" %}</button>
</div>
{% if cl.is_facets_optional or active_filters_count %}
<div id="changelist-filter-extra-actions" class="mb-2 flex justify-between">
{% if cl.is_facets_optional %}
<div class="form-control">
{% if cl.add_facets %}
<label class="label cursor-pointer text-sm">
<span class="label-text text-sm pe-2">{% translate "Show counts" %}</span>
<input checked value="{{ cl.remove_facet_link }}" type="checkbox"
class="toggle toggle-sm filter_show_count"/>
</label>
{% else %}
<label class="label cursor-pointer">
<span class="label-text pe-2">{% translate "Show counts" %}</span>
<input value="{{ cl.add_facet_link }}" type="checkbox"
class="toggle toggle-sm filter_show_count"/>
</label>
{% endif %}
</div>
{% endif %}
{% if active_filters_count %}
<h3 class="pt-1">
<a href="?"
class="link text-sm">
<i class="fa fa-times text-error"></i>
{% translate "Clear all filters" %}</a>
</h3>
{% endif %}
</div>
{% endif %}
{% for spec in cl.filter_specs %}
{% admin_list_filter cl spec request %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- End of drawer component -->

Expand Down Expand Up @@ -211,6 +214,12 @@ <h3 class="pt-1">

$('#changelist-form .search-submit').click(submit_search_form)

if ('{% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %}1{%endif%}') {
$('.navbar-nav-link').addClass('label')
$('.navbar-nav-link').parent().removeClass('card')
$('.navbar-nav-link').find('b').removeClass('mb-1')
$('.multi').removeClass('multi')
}
})
</script>
{% endblock %}
34 changes: 34 additions & 0 deletions django_daisy/templates/admin/date_hierarchy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% load i18n %}
{% if show %}
<div class="dropdown dropdown-hover">
<div tabindex="0" role="button" class="btn btn-outline btn-sm gap-2">
<i class="fa fa-calendar"></i>
<!-- {% trans 'Filter by date' %} -->
{% if back %}
<span class="badge badge-primary badge-sm">{{ back.title }}</span>
{% endif %}
</div>
<ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow-lg bg-base-100 rounded-box w-64">
{% if back %}
<li>
<a href="{{ back.link }}" class="flex items-center gap-2 text-primary hover:bg-primary hover:text-primary-content">
<i class="fa fa-arrow-left"></i>
{{ back.title }}
</a>
</li>
<!-- <li><hr class="divider my-1"></li> -->
{% endif %}
{% for choice in choices %}
<li>
{% if choice.link %}
<a href="{{ choice.link }}" class="hover:bg-base-200 {% if choice.title == current %}bg-primary text-primary-content{% endif %}">
{{ choice.title }}
</a>
{% else %}
<span class="text-base-content font-semibold bg-base-200 px-2 py-1 rounded">{{ choice.title }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}