mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge pull request 'Make community search retain search query, topic, language, and sort methods' (#387) from hono4kami/pyfedi:hono4kami/362 into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/387
This commit is contained in:
commit
52ba7203d8
1 changed files with 80 additions and 29 deletions
|
@ -27,27 +27,46 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
{% if topics -%}
|
||||
<form method="get" style="display:inline;">Topic:
|
||||
<select name="topic_id" class="form-control-sm submit_on_change" aria-label="{{ _('Choose a topic to filter communities by') }}">
|
||||
<option value="0">All</option>
|
||||
{% for topic in topics -%}
|
||||
<option value="{{ topic.id }}" {{ 'selected' if topic.id == topic_id }}>{{ topic.name }}</option>
|
||||
{% endfor -%}
|
||||
</select>
|
||||
</form>
|
||||
{% endif -%}
|
||||
{% if languages -%}
|
||||
<form method="get" style="display:inline;">Language:
|
||||
<select name="language_id" class="form-control-sm submit_on_change" aria-label="{{ _('Choose a language to filter communities by') }}">
|
||||
<option value="0">All</option>
|
||||
{% for language in languages -%}
|
||||
<option value="{{ language.id }}" {{ 'selected' if language.id == language_id }}>{{ language.name }}</option>
|
||||
{% endfor -%}
|
||||
</select>
|
||||
</form>
|
||||
{% endif -%}
|
||||
<form method="get" style="display:inline;"><input type="search" name="search" placeholder="{{ _('Search') }}" value="{{ search }}"></form>
|
||||
<form
|
||||
id="searchCommunities"
|
||||
method="get"
|
||||
>
|
||||
{% if topics -%}
|
||||
<div style="display:inline;">
|
||||
Topic:
|
||||
<select name="topic_id"
|
||||
class="form-control-sm submit_on_change"
|
||||
aria-label="{{ _('Choose a topic to filter communities by') }}"
|
||||
>
|
||||
<option value="0">All</option>
|
||||
{% for topic in topics -%}
|
||||
<option value="{{ topic.id }}" {{ 'selected' if topic.id == topic_id }}>{{ topic.name }}
|
||||
</option>
|
||||
{% endfor -%}
|
||||
</select>
|
||||
</div>
|
||||
{% endif -%}
|
||||
{% if languages -%}
|
||||
<div style="display:inline;">
|
||||
Language:
|
||||
<select name="language_id"
|
||||
class="form-control-sm submit_on_change"
|
||||
aria-label="{{ _('Choose a language to filter communities by') }}">
|
||||
<option value="0">All</option>
|
||||
{% for language in languages -%}
|
||||
<option value="{{ language.id }}" {{ 'selected' if language.id == language_id }}>{{ language.name }}
|
||||
</option>
|
||||
{% endfor -%}
|
||||
</select>
|
||||
</div>
|
||||
{% endif -%}
|
||||
<div style="display:inline;">
|
||||
<input type="search"
|
||||
name="search"
|
||||
placeholder="{{ _('Search') }}"
|
||||
value="{{ search }}">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
|
@ -67,24 +86,56 @@
|
|||
<tr>
|
||||
<th> </th>
|
||||
<th {% if not low_bandwidth -%}colspan="2"{% endif -%} scope="col">
|
||||
<a href="?sort_by=title{{ ' asc' if sort_by == 'title desc' else ' desc' }}" title="{{ _('Sort by name') }}" rel="nofollow">{{ _('Community') }}
|
||||
<button
|
||||
form="searchCommunities"
|
||||
hx-boost="true"
|
||||
name="sort_by"
|
||||
value="title{{ ' asc' if sort_by == 'title desc' else ' desc' }}"
|
||||
title="{{ _('Sort by name') }}"
|
||||
class="btn"
|
||||
>
|
||||
{{ _('Community') }}
|
||||
<span class="{{ 'fe fe-chevron-up' if sort_by == 'title asc' }}{{ 'fe fe-chevron-down' if sort_by == 'title desc' }}"></span>
|
||||
</a>
|
||||
</button>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<a href="?sort_by=post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}" title="{{ _('Sort by post count') }}" rel="nofollow">{{ _('Posts') }}
|
||||
<button
|
||||
form="searchCommunities"
|
||||
hx-boost="true"
|
||||
name="sort_by"
|
||||
value="post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}"
|
||||
title="{{ _('Sort by post count') }}"
|
||||
class="btn"
|
||||
>
|
||||
{{ _('Posts') }}
|
||||
<span class="{{ 'fe fe-chevron-up' if sort_by == 'post_count asc' }}{{ 'fe fe-chevron-down' if sort_by == 'post_count desc' }}"></span>
|
||||
</a>
|
||||
</button>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<a href="?sort_by=post_reply_count{{ ' asc' if sort_by == 'post_reply_count desc' else ' desc' }}" title="{{ _('Sort by reply count') }}" rel="nofollow">{{ _('Comments') }}
|
||||
<button
|
||||
form="searchCommunities"
|
||||
hx-boost="true"
|
||||
name="sort_by"
|
||||
value="post_reply_count{{ ' asc' if sort_by == 'post_reply_count desc' else ' desc' }}"
|
||||
title="{{ _('Comments') }}"
|
||||
class="btn"
|
||||
>
|
||||
{{ _('Comments') }}
|
||||
<span class="{{ 'fe fe-chevron-up' if sort_by == 'post_reply_count asc' }}{{ 'fe fe-chevron-down' if sort_by == 'post_reply_count desc' }}"></span>
|
||||
</a>
|
||||
</button>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<a href="?sort_by=last_active{{ ' asc' if sort_by == 'last_active desc' else ' desc' }}" title="{{ _('Sort by recent activity') }}" rel="nofollow">{{ _('Active') }}
|
||||
<button
|
||||
form="searchCommunities"
|
||||
hx-boost="true"
|
||||
name="sort_by"
|
||||
value="last_active{{ ' asc' if sort_by == 'last_active desc' else ' desc' }}"
|
||||
title="{{ _('Sort by recent activity') }}"
|
||||
class="btn"
|
||||
>
|
||||
{{ _('Active') }}
|
||||
<span class="{{ 'fe fe-chevron-up' if sort_by == 'last_active asc' }}{{ 'fe fe-chevron-down' if sort_by == 'last_active desc' }}"></span>
|
||||
</a>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
Loading…
Reference in a new issue