feat: make community search retain post_count sort

Refs: #362
This commit is contained in:
hono4kami 2024-12-17 20:03:13 +07:00 committed by hono4kami
parent 3e91ee34f7
commit 61963a43dc

View file

@ -99,9 +99,18 @@
</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
hx-get="/communities"
hx-vals='{"sort_by": "post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}"}'
hx-include="form[action='/communities']"
hx-target="body"
hx-push-url="true"
title="{{ _('Sort by name') }}"
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') }}