mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-01 14:01:35 +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 %}
|
{% block filter %}
|
||||||
<legend class="label">{% trans "Community" %}</legend>
|
<legend class="label">{% trans "Community" %}</legend>
|
||||||
<label class="is-block">
|
<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" %}
|
{% trans "Local users" %}
|
||||||
</label>
|
</label>
|
||||||
<label class="is-block">
|
<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" %}
|
{% trans "Federated community" %}
|
||||||
</label>
|
</label>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<select name="sort" id="id_sort">
|
<select name="sort" id="id_sort">
|
||||||
<option value="recent" {% if request.GET.sort == "recent" %}selected{% endif %}>{% trans "Recently active" %}</option>
|
<option value="recent" {% if sort == "recent" %}selected{% endif %}>{% trans "Recently active" %}</option>
|
||||||
<option value="suggested" {% if request.GET.sort == "suggested" %}selected{% endif %}>{% trans "Suggested" %}</option>
|
<option value="suggested" {% if sort == "suggested" %}selected{% endif %}>{% trans "Suggested" %}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Directory(View):
|
||||||
software = request.GET.get("software")
|
software = request.GET.get("software")
|
||||||
if not software or software == "bookwyrm":
|
if not software or software == "bookwyrm":
|
||||||
filters["bookwyrm_user"] = True
|
filters["bookwyrm_user"] = True
|
||||||
scope = request.GET.get("scope")
|
scope = request.GET.get("scope", "federated")
|
||||||
if scope == "local":
|
if scope == "local":
|
||||||
filters["local"] = True
|
filters["local"] = True
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ class Directory(View):
|
||||||
page.number, on_each_side=2, on_ends=1
|
page.number, on_each_side=2, on_ends=1
|
||||||
),
|
),
|
||||||
"users": page,
|
"users": page,
|
||||||
|
"sort": sort,
|
||||||
|
"scope": scope,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "directory/directory.html", data)
|
return TemplateResponse(request, "directory/directory.html", data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue