mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 11:01:12 +00:00
Make sure defaults are set on directory filters
This commit is contained in:
parent
27c40ccf20
commit
e8949bbffd
3 changed files with 7 additions and 5 deletions
|
@ -4,11 +4,11 @@
|
|||
{% block filter %}
|
||||
<legend class="label">{% trans "Community" %}</legend>
|
||||
<label class="is-block">
|
||||
<input type="radio" class="radio" name="scope" value="local" {% if request.GET.scope == "local" %}checked{% endif %}>
|
||||
<input type="radio" class="radio" name="scope" value="local" {% if scope == "local" %}checked{% endif %}>
|
||||
{% trans "Local users" %}
|
||||
</label>
|
||||
<label class="is-block">
|
||||
<input type="radio" class="radio" name="scope" value="federated" {% if request.GET.scope == "federated" %}checked{% endif %}>
|
||||
<input type="radio" class="radio" name="scope" value="federated" {% if scope == "federated" %}checked{% endif %}>
|
||||
{% trans "Federated community" %}
|
||||
</label>
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<div class="control">
|
||||
<div class="select">
|
||||
<select name="sort" id="id_sort">
|
||||
<option value="recent" {% if request.GET.sort == "recent" %}selected{% endif %}>{% trans "Recently active" %}</option>
|
||||
<option value="suggested" {% if request.GET.sort == "suggested" %}selected{% endif %}>{% trans "Suggested" %}</option>
|
||||
<option value="recent" {% if sort == "recent" %}selected{% endif %}>{% trans "Recently active" %}</option>
|
||||
<option value="suggested" {% if sort == "suggested" %}selected{% endif %}>{% trans "Suggested" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@ class Directory(View):
|
|||
software = request.GET.get("software")
|
||||
if not software or software == "bookwyrm":
|
||||
filters["bookwyrm_user"] = True
|
||||
scope = request.GET.get("scope")
|
||||
scope = request.GET.get("scope", "federated")
|
||||
if scope == "local":
|
||||
filters["local"] = True
|
||||
|
||||
|
@ -38,6 +38,8 @@ class Directory(View):
|
|||
page.number, on_each_side=2, on_ends=1
|
||||
),
|
||||
"users": page,
|
||||
"sort": sort,
|
||||
"scope": scope,
|
||||
}
|
||||
return TemplateResponse(request, "directory/directory.html", data)
|
||||
|
||||
|
|
Loading…
Reference in a new issue