Extensions list: sort_by parameter #159

Merged
Márton Lente merged 36 commits from filter-sort into main 2024-06-03 12:57:45 +02:00
2 changed files with 54 additions and 24 deletions
Showing only changes of commit 4ffb5c8d9d - Show all commits

View File

@ -10,6 +10,10 @@
+margin(2, left) +margin(2, left)
.form-control-sm .form-control-sm
font-size: var(--fs-sm)
height: calc(var(--spacer) * 2)
+padding(0, y)
&[type="file"] &[type="file"]
font-size: var(--fs-xs) font-size: var(--fs-xs)
height: calc(var(--spacer) * 2) height: calc(var(--spacer) * 2)
@ -22,3 +26,8 @@
.was-validated .form-control:invalid, .was-validated .form-control:invalid,
.form-control.is-invalid .form-control.is-invalid
background-image: none background-image: none
select
&.form-control
&:hover
cursor: pointer

View File

@ -6,33 +6,56 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-12 my-4"> <div class="col-md-12 my-4">
{% if author %}
<h2>{% blocktranslate %}Extensions by{% endblocktranslate %} <em class="search-highlight">{{ author }}</em></h2>
{% endif %}
{% if team %}
<h2>{% blocktranslate %}Extensions by{% endblocktranslate %} <em class="search-highlight">{{ team.name }}</em></h2>
{% endif %}
{% if tag %}
<h2 class="d-flex align-items-center">
<span class="me-3">{% blocktranslate %}Extensions with the tag{% endblocktranslate %}</span>
{% include "extensions/components/badge_tag.html" %}
</h2>
{% endif %}
{% if type %} {% if type %}
<h2>{{ type }}</h2> <div class="align-items-center d-flex justify-content-between mb-3">
{% endif %} <h2>{{ type }}</h2>
{% if request.GET.q %}
<h2>{{ page_obj.paginator.count }} result{{ page_obj.paginator.count | pluralize }} for <em class="search-highlight">{{ request.GET.q }}</em></h2> {# TODO: @back-end add sort based on select options #}
<div class="box d-flex p-2">
<label class="align-items-center d-flex fs-sm mb-0 me-3 text-nowrap"><i class="i-repeat me-1"></i>Sort by</label>
<select class="form-control form-control-sm">
<option value="-date_approved">Newest First</option>
<option value="date_approved">Oldest First</option>
<option value="-date_modified">Recently Updated</option>
<option value="-total_ratings_count">Most Reviewed</option>
<option value="-average_score">Rating</option>
<option value="-download_count">Downloads</option>
<option value="-name">Title (A-Z)</option>
<option value="name">Title (Z-A)</option>
</select>
</div>
</div>
{% else %}
{% if author %}
<h2>{% blocktranslate %}Extensions by{% endblocktranslate %} <em class="search-highlight">{{ author }}</em></h2>
{% endif %}
{% if team %}
<h2>{% blocktranslate %}Extensions by{% endblocktranslate %} <em class="search-highlight">{{ team.name }}</em></h2>
{% endif %}
{% if tag %}
<h2 class="d-flex align-items-center">
<span class="me-3">{% blocktranslate %}Extensions with the tag{% endblocktranslate %}</span>
{% include "extensions/components/badge_tag.html" %}
</h2>
{% endif %}
{% if request.GET.q %}
<h2>{{ page_obj.paginator.count }} result{{ page_obj.paginator.count | pluralize }} for <em class="search-highlight">{{ request.GET.q }}</em></h2>
{% endif %}
{% endif %} {% endif %}
{% if tags %} {% if tags %}
<div class="row"> <div class="mb-3 row">
<div class="col-md-12"> <div class="col-md-12">
<div class="box p-2"> <div class="box p-2">
<div class="btn-row"> <div class="btn-row">
{# TODO: @back-end add conditional link to either Add-ons or Themes pages #} {# TODO: @back-end add conditional link to either Add-ons or Themes pages #}
<a class="btn btn-sm {% if not tag %}btn-primary{% endif %}" href="/add-ons" title="All"> <a class="align-items-center btn btn-sm d-flex {% if not tag %}btn-primary{% endif %}" href="/add-ons" title="All">
All <div>
All
</div>
<div class="align-items-center bg-primary d-flex h-3 fs-xs justify-content-center ms-2 rounded-circle w-3">
1
</div>
</a> </a>
{% for list_tag in tags %} {% for list_tag in tags %}
<a class="align-items-center btn btn-sm d-flex {% if tag == list_tag %}btn-primary{% endif %}" href="{% url "extensions:by-tag" tag_slug=list_tag.slug %}" title="{{ list_tag.name }}"> <a class="align-items-center btn btn-sm d-flex {% if tag == list_tag %}btn-primary{% endif %}" href="{% url "extensions:by-tag" tag_slug=list_tag.slug %}" title="{{ list_tag.name }}">
@ -40,11 +63,9 @@
{{ list_tag.name }} {{ list_tag.name }}
</div> </div>
{# TODO: @back-end add tags count dynamic #} {# TODO: @back-end add tags count dynamic #}
{% comment %} <div class="align-items-center bg-primary d-flex h-3 fs-xs justify-content-center ms-2 rounded-circle w-3">
<div class="align-items-center bg-primary d-flex h-3 fs-xs justify-content-center ms-2 rounded-circle w-3"> 1
1 </div>
</div>
{% endcomment %}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>