changing exclude / include to checkboxes

This commit is contained in:
David Kennedy 2024-03-28 06:50:07 -04:00
parent 12524403ef
commit f200ba465c
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 37 additions and 0 deletions

View file

@ -966,6 +966,8 @@ class DomainRequestAdmin(ListHeaderAdmin):
title = "Status"
parameter_name = "status__in"
template = "django/admin/multiple_choice_list_filter.html"
def lookups(self, request, model_admin):
return DomainRequest.DomainRequestStatus.choices

View file

@ -350,3 +350,15 @@ input.admin-confirm-button {
.errors span.select2-selection {
border: 1px solid var(--error-fg) !important;
}
.choice-filter {
padding-left: 20px;
}
.choice-filter--checked {
background-image: url("/public/img/sprite.svg#check");
}
.choice-filter--unchecked {
background-image: url("/public/img/sprite.svg#check_box_outline_blank");
}

View file

@ -0,0 +1,23 @@
{% load i18n %}
<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3>
<ul class="mulitple-choice">
{% for choice in choices %}
{% if choice.reset %}
<li{% if choice.selected %} class="selected"{% endif %}>
<a href="{{ choice.query_string|iriencode }}" title="{{ choice.display }}">{{ choice.display }}</a>
</li>
{% endif %}
{% endfor %}
{% for choice in choices %}
{% if not choice.reset %}
<li{% if choice.selected %} class="selected"{% endif %}>
{% if choice.selected and choice.exclude_query_string %}
<a class="choice-filter choice-filter--checked" href="{{ choice.exclude_query_string|iriencode }}">{{ choice.display }}</a>
{% endif %}
{% if not choice.selected and choice.include_query_string %}
<a class="choice-filter choice-filter--unchecked" href="{{ choice.include_query_string|iriencode }}">{{ choice.display }}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>