Introduces filters snippets
This commit is contained in:
14
bookwyrm/templates/directory/community_filter.html
Normal file
14
bookwyrm/templates/directory/community_filter.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% 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 %}>
|
||||
{% trans "Local users" %}
|
||||
</label>
|
||||
<label class="is-block">
|
||||
<input type="radio" class="radio" name="scope" value="federated" {% if not request.GET.sort or request.GET.scope == "federated" %}checked{% endif %}>
|
||||
{% trans "Federated community" %}
|
||||
</label>
|
||||
{% endblock %}
|
109
bookwyrm/templates/directory/directory.html
Normal file
109
bookwyrm/templates/directory/directory.html
Normal file
@ -0,0 +1,109 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}{% trans "Directory" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<header class="block">
|
||||
<h1 class="title">
|
||||
{% trans "Directory" %}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
{% if not request.user.discoverable %}
|
||||
<div class="box has-text-centered content" data-hide="hide-join-directory"><div class="columns">
|
||||
<div class="column">
|
||||
<p>
|
||||
{% trans "Make your profile discoverable to other BookWyrm users." %}
|
||||
</p>
|
||||
<form name="directory" method="POST" action="{% url 'directory' %}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-primary" type="submit">Join Directory</button>
|
||||
<p class="help">
|
||||
{% url 'settings-profile' as path %}
|
||||
{% blocktrans %}You can opt-out at any time in your <a href="{{ path }}">profile settings.</a>{% endblocktrans %}
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
{% trans "Dismiss message" as button_text %}
|
||||
<button type="button" class="delete set-display" data-id="hide-join-directory" data-value="true">
|
||||
<span>Dismiss message</span>
|
||||
</button>
|
||||
</div>
|
||||
</div></div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'directory/filters.html' %}
|
||||
|
||||
<div class="columns is-multiline">
|
||||
{% for user in users %}
|
||||
<div class="column is-one-third">
|
||||
<div class="card block">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<span class="media-left">
|
||||
{% include 'snippets/avatar.html' with user=user large=True %}
|
||||
</span>
|
||||
<div class="media-content">
|
||||
<a href="{{ user.local_path }}" class="is-block mb-2">
|
||||
<span class="title is-4 is-block">{{ user.display_name }}</span>
|
||||
<span class="subtitle is-7 is-block">@{{ user|username }}</span>
|
||||
</a>
|
||||
{% include 'snippets/follow_button.html' with user=user %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
{% if user.summary %}
|
||||
{{ user.summary | to_markdown | safe | truncatechars_html:40 }}
|
||||
{% else %} {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<footer class="card-footer content">
|
||||
{% if user != request.user %}
|
||||
{% if user.mutuals %}
|
||||
<div class="card-footer-item">
|
||||
<div class="has-text-centered">
|
||||
<p class="title is-6 mb-0">{{ user.mutuals }}</p>
|
||||
<p class="help">{% blocktrans count counter=user.mutuals %}follower you follow{% plural %}followers you follow{% endblocktrans %}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% elif user.shared_books %}
|
||||
<div class="card-footer-item">
|
||||
<div class="has-text-centered">
|
||||
<p class="title is-6 mb-0">{{ user.shared_books }}</p>
|
||||
<p class="help">{% blocktrans count counter=user.shared_books %}book on your shelves{% plural %}books on your shelves{% endblocktrans %}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div class="card-footer-item">
|
||||
<div class="has-text-centered">
|
||||
<p class="title is-6 mb-0">{{ user.status_set.count|intword }}</p>
|
||||
<p class="help">{% trans "posts" %}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer-item">
|
||||
<div class="has-text-centered">
|
||||
<p class="title is-6 mb-0">{{ user.last_active_date|naturalday }}</p>
|
||||
<p class="help">{% trans "last active" %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% include 'snippets/pagination.html' with page=users path="/directory" %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/static/js/localstorage.js"></script>
|
||||
{% endblock %}
|
7
bookwyrm/templates/directory/filters.html
Normal file
7
bookwyrm/templates/directory/filters.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends 'snippets/filters_panel/filters_panel.html' %}
|
||||
|
||||
{% block filter_fields %}
|
||||
{% include 'directory/user_type_filter.html' %}
|
||||
{% include 'directory/community_filter.html' %}
|
||||
{% include 'directory/sort_filter.html' %}
|
||||
{% endblock %}
|
12
bookwyrm/templates/directory/sort_filter.html
Normal file
12
bookwyrm/templates/directory/sort_filter.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label" for="id_sort">{% trans "Order by" %}</label>
|
||||
<div class="select">
|
||||
<select name="sort" id="id_sort">
|
||||
<option value="suggested" {% if not request.GET.sort or request.GET.sort == "suggested" %}checked{% endif %}>{% trans "Suggested" %}</option>
|
||||
<option value="recent" {% if request.GET.sort == "suggested" %}checked{% endif %}>{% trans "Recently active" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
{% endblock %}
|
14
bookwyrm/templates/directory/user_type_filter.html
Normal file
14
bookwyrm/templates/directory/user_type_filter.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<legend class="label">{% trans "User type" %}</legend>
|
||||
<label class="is-block">
|
||||
<input type="radio" class="radio" name="software" value="bookwyrm" {% if not request.GET.sort or request.GET.software == 'bookwyrm' %}checked{% endif %}>
|
||||
{% trans "BookWyrm users" %}
|
||||
</label>
|
||||
<label class="is-block">
|
||||
<input type="radio" class="radio" name="software" value="all" {% if request.GET.software == 'all' %}checked{% endif %}>
|
||||
{% trans "All known users" %}
|
||||
</label>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user