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 5 additions and 3 deletions
Showing only changes of commit 32f2a2e034 - Show all commits

View File

@ -66,12 +66,12 @@
{% endif %} {% endif %}
<div class="dropdown dropdown-filter-sort"> <div class="dropdown dropdown-filter-sort">
<button class="dropdown-toggle js-dropdown-toggle" data-toggle-menu-id="js-dropdown-menu-sort"> <button class="dropdown-toggle js-dropdown-toggle" data-toggle-menu-id="js-dropdown-menu-sort">
Sort by <i class="i-chevron-down"></i> Sort by {{ sort_by_option_name }} <i class="i-chevron-down"></i>
</button> </button>
<ul class="dropdown-menu dropdown-menu-filter-sort dropdown-menu-right js-dropdown-menu" id="js-dropdown-menu-sort"> <ul class="dropdown-menu dropdown-menu-filter-sort dropdown-menu-right js-dropdown-menu" id="js-dropdown-menu-sort">
{% for option_sort_by, name in sort_by_options.items %} {% for option_sort_by, name in sort_by_options.items %}
<li> <li>
<a class="dropdown-item{% if option_sort_by == sort_by %} is-active{% endif %}" href="?{% query_transform sort_by=option_sort_by %}"> <a class="dropdown-item{% if option_sort_by == sort_by %} is-active{% endif %}" href="?{% query_transform sort_by=option_sort_by %}">
{{ name }} {{ name }}
</a> </a>
</li> </li>

View File

@ -141,7 +141,9 @@ class SearchView(ListedExtensionsView):
if self.kwargs.get('team_slug'): if self.kwargs.get('team_slug'):
context['team'] = get_object_or_404(teams.models.Team, slug=self.kwargs['team_slug']) context['team'] = get_object_or_404(teams.models.Team, slug=self.kwargs['team_slug'])
context['sort_by'] = self._get_sort_by() sort_by = self._get_sort_by()
context['sort_by'] = sort_by
context['sort_by_option_name'] = self.sort_by_options.get(sort_by)
context['sort_by_options'] = self.sort_by_options context['sort_by_options'] = self.sort_by_options
# Determine which tags to list depending on the context. # Determine which tags to list depending on the context.