mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -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>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|
<form
|
||||||
|
id="searchCommunities"
|
||||||
|
method="get"
|
||||||
|
>
|
||||||
{% if topics -%}
|
{% if topics -%}
|
||||||
<form method="get" style="display:inline;">Topic:
|
<div style="display:inline;">
|
||||||
<select name="topic_id" class="form-control-sm submit_on_change" aria-label="{{ _('Choose a topic to filter communities by') }}">
|
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>
|
<option value="0">All</option>
|
||||||
{% for topic in topics -%}
|
{% for topic in topics -%}
|
||||||
<option value="{{ topic.id }}" {{ 'selected' if topic.id == topic_id }}>{{ topic.name }}</option>
|
<option value="{{ topic.id }}" {{ 'selected' if topic.id == topic_id }}>{{ topic.name }}
|
||||||
|
</option>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</div>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if languages -%}
|
{% if languages -%}
|
||||||
<form method="get" style="display:inline;">Language:
|
<div style="display:inline;">
|
||||||
<select name="language_id" class="form-control-sm submit_on_change" aria-label="{{ _('Choose a language to filter communities by') }}">
|
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>
|
<option value="0">All</option>
|
||||||
{% for language in languages -%}
|
{% for language in languages -%}
|
||||||
<option value="{{ language.id }}" {{ 'selected' if language.id == language_id }}>{{ language.name }}</option>
|
<option value="{{ language.id }}" {{ 'selected' if language.id == language_id }}>{{ language.name }}
|
||||||
|
</option>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</div>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
<form method="get" style="display:inline;"><input type="search" name="search" placeholder="{{ _('Search') }}" value="{{ search }}"></form>
|
<div style="display:inline;">
|
||||||
|
<input type="search"
|
||||||
|
name="search"
|
||||||
|
placeholder="{{ _('Search') }}"
|
||||||
|
value="{{ search }}">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
@ -67,24 +86,56 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th {% if not low_bandwidth -%}colspan="2"{% endif -%} scope="col">
|
<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>
|
<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>
|
||||||
<th scope="col">
|
<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>
|
<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>
|
||||||
<th scope="col">
|
<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>
|
<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>
|
||||||
<th scope="col">
|
<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>
|
<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>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
Loading…
Add table
Reference in a new issue