14731 sort / status

This commit is contained in:
Arthur Hanson 2024-07-09 14:37:18 +07:00
parent 36e268300f
commit d2945c9cac
2 changed files with 19 additions and 27 deletions

View File

@ -806,6 +806,10 @@ class PluginListView(UserPassesTestMixin, View):
return render(request, 'core/plugin_list.html', { return render(request, 'core/plugin_list.html', {
'plugins': plugins, 'plugins': plugins,
'sort_choices': dict(PluginSortChoices),
'status_choices': dict(PluginStatusChoices),
'sort': sort,
'status': status,
}) })

View File

@ -39,17 +39,15 @@
{% trans "Status" %} {% trans "Status" %}
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{% trans "Status" %} {{ status_choices|get_key:status }}
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?status=all"> {% for level, name in status_choices.items %}
{% trans "All" %} <a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?status={{ level }}">
{% if status == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %} {{ name }}
</a> {% if level == status %}<span class="badge bg-green ms-auto"></span>{% endif %}
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?status=installed">
{% trans "Installed" %}
{% if status == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
</a> </a>
{% endfor %}
</div> </div>
</div> </div>
</div> </div>
@ -60,25 +58,15 @@
{% trans "Sort" %} {% trans "Sort" %}
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{% trans "Sort" %} {{ sort_choices|get_key:sort }}
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?sort=az"> {% for level, name in sort_choices.items %}
{% trans "By Name (A-Z)" %} <a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?sort={{ level }}">
{% if sort == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %} {{ name }}
</a> {% if level == sort %}<span class="badge bg-green ms-auto"></span>{% endif %}
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?sort=za">
{% trans "By Name (Z-A)" %}
{% if sort == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
</a>
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?sort=updated">
{% trans "By updated date" %}
{% if sort == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
</a>
<a class="dropdown-item d-flex justify-content-between" href="{% url 'core:plugin_list' %}?sort=published">
{% trans "By published date" %}
{% if sort == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
</a> </a>
{% endfor %}
</div> </div>
</div> </div>
</div> </div>