fix: fix weird behavior on URL search params

Fix weird behavior where URL search params value gets appended instead of
being replaced.

Refs: #362
This commit is contained in:
hono4kami 2024-12-17 21:05:16 +07:00 committed by hono4kami
parent 2d2e18abf7
commit d78cf0cef6

View file

@ -87,11 +87,10 @@
<th> </th> <th> </th>
<th {% if not low_bandwidth -%}colspan="2"{% endif -%} scope="col"> <th {% if not low_bandwidth -%}colspan="2"{% endif -%} scope="col">
<button <button
hx-get="" form="searchCommunities"
hx-vals='{"sort_by": "title{{ ' asc' if sort_by == 'title desc' else ' desc' }}"}' hx-boost="true"
hx-include="form[action='/communities']" name="sort_by"
hx-target="body" value="title{{ ' asc' if sort_by == 'title desc' else ' desc' }}"
hx-push-url="true"
title="{{ _('Sort by name') }}" title="{{ _('Sort by name') }}"
class="btn" class="btn"
> >
@ -101,11 +100,10 @@
</th> </th>
<th scope="col"> <th scope="col">
<button <button
hx-get="" form="searchCommunities"
hx-vals='{"sort_by": "post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}"}' hx-boost="true"
hx-include="#searchCommunities" name="sort_by"
hx-target="body" value="post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}"
hx-push-url="true"
title="{{ _('Sort by post count') }}" title="{{ _('Sort by post count') }}"
class="btn" class="btn"
> >
@ -115,11 +113,10 @@
</th> </th>
<th scope="col"> <th scope="col">
<button <button
hx-get="" form="searchCommunities"
hx-vals='{"sort_by": "post_reply_count{{ ' asc' if sort_by == 'post_reply_count desc' else ' desc' }}"}' hx-boost="true"
hx-include="form[action='/communities']" name="sort_by"
hx-target="body" value="post_reply_count{{ ' asc' if sort_by == 'post_reply_count desc' else ' desc' }}"
hx-push-url="true"
title="{{ _('Comments') }}" title="{{ _('Comments') }}"
class="btn" class="btn"
> >
@ -129,11 +126,10 @@
</th> </th>
<th scope="col"> <th scope="col">
<button <button
hx-get="" form="searchCommunities"
hx-vals='{"sort_by": "last_active{{ ' asc' if sort_by == 'last_active desc' else ' desc' }}"}' hx-boost="true"
hx-include="form[action='/communities']" name="sort_by"
hx-target="body" value="last_active{{ ' asc' if sort_by == 'last_active desc' else ' desc' }}"
hx-push-url="true"
title="{{ _('Sort by recent activity') }}" title="{{ _('Sort by recent activity') }}"
class="btn" class="btn"
> >