moviewyrm/bookwyrm/templates/directory.html

146 lines
6.2 KiB
HTML
Raw Normal View History

2021-03-21 23:37:52 +00:00
{% 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>
2021-03-25 15:39:45 +00:00
{% if not request.user.discoverable %}
<div class="box has-text-centered content">
{% url 'settings-profile' as path %}
<p>
{% trans "Make your profile discoverable to other BookWyrm users." %}
2021-03-25 15:39:45 +00:00
</p>
<form name="directory" method="POST" action="{% url 'directory' %}">
{% csrf_token %}
<button class="button is-primary" type="submit">Join Directory</button>
<p class="help">
{% blocktrans %}You can opt-out at any time in your <a href="{{ path }}">profile settings</a>{% endblocktrans %}
</p>
</form>
</div>
{% endif %}
2021-03-25 17:58:00 +00:00
<div class="notification content">
<h2 class="columns is-mobile mb-0">
<span class="column pb-0">Filters</span>
<span class="column is-narrow pb-0">
{% trans "Show filters" as text %}
{% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon="arrow-down" class="is-small" %}
{% trans "Hide filters" as text %}
{% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon="x" class="is-small" %}
</span>
</h2>
2021-03-25 20:36:35 +00:00
<form class="hidden mt-3" id="filters" method-"get" action="{% url 'directory' %}">
2021-03-25 17:58:00 +00:00
<div class="columns">
2021-03-25 20:36:35 +00:00
<div class="column is-flex">
<div class="box is-flex-grow-1">
<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>
2021-03-25 17:58:00 +00:00
</div>
</div>
2021-03-25 20:36:35 +00:00
<div class="column is-flex">
<div class="box is-flex-grow-1">
<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>
2021-03-25 17:58:00 +00:00
</div>
</div>
2021-03-25 20:36:35 +00:00
<div class="column is-flex">
<div class="box is-flex-grow-1">
2021-03-25 20:44:11 +00:00
<label class="label" for="id_sort">{% trans "Order by" %}</label>
2021-03-25 17:58:00 +00:00
<div class="select">
2021-03-25 20:44:11 +00:00
<select name="sort" id="id_sort">
2021-03-25 20:36:35 +00:00
<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>
2021-03-25 17:58:00 +00:00
</select>
</div>
</div>
</div>
</div>
<button class="button is-primary">{% trans "Apply filters" %}</button>
2021-03-25 20:36:35 +00:00
</form>
2021-03-25 20:39:19 +00:00
{% if request.GET %}
<a class="help" href="{% url 'directory' %}">{% trans "Clear filters" %}</a>
{% endif %}
2021-03-25 17:58:00 +00:00
</div>
2021-03-21 23:37:52 +00:00
<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>
2021-03-21 23:37:52 +00:00
</a>
{% include 'snippets/follow_button.html' with user=user %}
</div>
</div>
<div class="content">
{% if user.summary %}
2021-03-21 23:37:52 +00:00
{{ user.summary | to_markdown | safe | truncatechars_html:40 }}
{% else %}&nbsp;{% endif %}
2021-03-21 23:37:52 +00:00
</div>
</div>
<footer class="card-footer content">
2021-03-25 20:36:35 +00:00
{% if user != request.user %}
2021-03-21 23:37:52 +00:00
<div class="card-footer-item">
<div class="has-text-centered">
2021-03-25 20:36:35 +00:00
<p class="title is-6 mb-0">{{ user.mutuals }}</p>
<p class="help">{% trans "followers you follow" %}</p>
2021-03-21 23:37:52 +00:00
</div>
</div>
2021-03-25 20:36:35 +00:00
{% endif %}
2021-03-21 23:37:52 +00:00
<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 %}