1
0
Fork 0

Merge pull request #1021 from bookwyrm-social/following-display

Cleans up user/followers/following pages
This commit is contained in:
Mouse Reeve 2021-04-30 13:49:44 -07:00 committed by GitHub
commit de017ca7ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 153 additions and 148 deletions

View file

@ -1,4 +1,4 @@
{% extends 'user/user_layout.html' %}
{% extends 'user/layout.html' %}
{% load i18n %}
{% block header %}

View file

@ -1,34 +0,0 @@
{% extends 'user/user_layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block header %}
<h1 class="title">
{% trans "User Profile" %}
</h1>
{% endblock %}
{% block panel %}
<div class="block">
<h2 class="title">{% trans "Followers" %}</h2>
{% for follower in followers %}
<div class="block columns">
<div class="column">
<a href="{{ follower.local_path }}">
{% include 'snippets/avatar.html' with user=follower %}
{{ follower.display_name }}
</a>
({{ follower.username }})
</div>
<div class="column is-narrow">
{% include 'snippets/follow_button.html' with user=follower %}
</div>
</div>
{% endfor %}
{% if not followers.count %}
<div>{% blocktrans with username=user.display_name %}{{ username }} has no followers{% endblocktrans %}</div>
{% endif %}
</div>
{% include 'snippets/pagination.html' with page=followers path=request.path %}
{% endblock %}

View file

@ -1,34 +0,0 @@
{% extends 'user/user_layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block header %}
<h1 class="title">
{% trans "User Profile" %}
</h1>
{% endblock %}
{% block panel %}
<div class="block">
<h2 class="title">{% trans "Following" %}</h2>
{% for follower in user.following.all %}
<div class="block columns">
<div class="column">
<a href="{{ follower.local_path }}">
{% include 'snippets/avatar.html' with user=follower %}
{{ follower.display_name }}
</a>
({{ follower.username }})
</div>
<div class="column">
{% include 'snippets/follow_button.html' with user=follower %}
</div>
</div>
{% endfor %}
{% if not following.count %}
<div>{% blocktrans with username=user|username %}{{ username }} isn't following any users{% endblocktrans %}</div>
{% endif %}
</div>
{% include 'snippets/pagination.html' with page=following path=request.path %}
{% endblock %}

View file

@ -7,7 +7,11 @@
{% block content %}
<header class="block">
{% block header %}{% endblock %}
{% block header %}
<h1 class="title">
{% trans "User Profile" %}
</h1>
{% endblock %}
</header>
{# user bio #}
@ -41,8 +45,9 @@
</div>
{% endif %}
</div>
{% block tabs %}
{% with user|username as username %}
{% if 'user/'|add:username|add:'/books' not in request.path and 'user/'|add:username|add:'/shelf' not in request.path %}
<nav class="tabs">
<ul>
{% url 'user-feed' user|username as url %}
@ -70,8 +75,8 @@
{% endif %}
</ul>
</nav>
{% endif %}
{% endwith %}
{% endblock %}
{% block panel %}{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends 'user/user_layout.html' %}
{% extends 'user/layout.html' %}
{% load i18n %}
{% block header %}

View file

@ -0,0 +1,14 @@
{% extends 'user/relationships/layout.html' %}
{% load i18n %}
{% block header %}
<h1 class="title">
{% trans "Followers" %}
</h1>
{% endblock %}
{% block nullstate %}
<div>
{% blocktrans with username=user.display_name %}{{ username }} has no followers{% endblocktrans %}
</div>
{% endblock %}

View file

@ -0,0 +1,14 @@
{% extends 'user/relationships/layout.html' %}
{% load i18n %}
{% block header %}
<h1 class="title">
{% trans "Following" %}
</h1>
{% endblock %}
{% block nullstate %}
<div>
{% blocktrans with username=user.display_name %}{{ username }} isn't following any users{% endblocktrans %}
</div>
{% endblock %}

View file

@ -0,0 +1,46 @@
{% extends 'user/layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block tabs %}
{% with user|username as username %}
<nav class="tabs">
<ul>
{% url 'user-followers' user|username as url %}
<li{% if url == request.path or url == request.path|add:'/' %} class="is-active"{% endif %}>
<a href="{{ url }}">{% trans "Followers" %}</a>
</li>
{% url 'user-following' user|username as url %}
<li{% if url == request.path or url == request.path|add:'/' %} class="is-active"{% endif %}>
<a href="{{ url }}">{% trans "Following" %}</a>
</li>
</ul>
</nav>
{% endwith %}
{% endblock %}
{% block panel %}
<div class="block">
{% for follow in follow_list %}
<div class="block columns">
<div class="column">
<a href="{{ follower.local_path }}">
{% include 'snippets/avatar.html' with user=follow %}
{{ follow.display_name }}
</a>
({{ follow.username }})
</div>
<div class="column is-narrow">
{% include 'snippets/follow_button.html' with user=follow %}
</div>
</div>
{% endfor %}
{% if not follow_list %}
{% block nullstate %}
{% endblock %}
{% endif %}
</div>
{% include 'snippets/pagination.html' with page=follow_list path=request.path %}
{% endblock %}

View file

@ -1,21 +1,21 @@
{% extends 'user/user_layout.html' %}
{% extends 'user/layout.html' %}
{% load bookwyrm_tags %}
{% load humanize %}
{% load i18n %}
{% block title %}
{% include 'user/books_header.html' %}
{% include 'user/shelf/books_header.html' %}
{% endblock %}
{% block header %}
<header class="columns">
<h1 class="title">
{% include 'user/books_header.html' %}
{% include 'user/shelf/books_header.html' %}
</h1>
</header>
{% endblock %}
{% block panel %}
{% block tabs %}
<div class="block columns">
<div class="column">
<div class="tabs">
@ -39,9 +39,11 @@
</div>
{% endif %}
</div>
{% endblock %}
{% block panel %}
<div class="block">
{% include 'user/create_shelf_form.html' with controls_text='create-shelf-form' %}
{% include 'user/shelf/create_shelf_form.html' with controls_text='create-shelf-form' %}
</div>
<div class="block columns is-mobile">
@ -62,7 +64,7 @@
</div>
<div class="block">
{% include 'user/edit_shelf_form.html' with controls_text="edit-shelf-form" %}
{% include 'user/shelf/edit_shelf_form.html' with controls_text="edit-shelf-form" %}
</div>
<div class="block">

View file

@ -1,4 +1,4 @@
{% extends 'user/user_layout.html' %}
{% extends 'user/layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
@ -11,7 +11,7 @@
</div>
{% if is_self %}
<div class="column is-narrow">
<a href="/preferences/profile">
<a href="{% url 'prefs-profile' %}">
<span class="icon icon-pencil" title="Edit profile">
<span class="is-sr-only">{% trans "Edit profile" %}</span>
</span>
@ -25,7 +25,7 @@
{% if user.bookwyrm_user %}
<div class="block">
<h2 class="title">
{% include 'user/books_header.html' %}
{% include 'user/shelf/books_header.html' %}
</h2>
<div class="columns">
{% for shelf in shelves %}

View file

@ -1,5 +1,6 @@
{% load i18n %}
{% load humanize %}
{% load bookwyrm_tags %}
<div class="media block">
<div class="media-left">
@ -12,8 +13,19 @@
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
<p>{% blocktrans with date=user.created_date|naturaltime %}Joined {{ date }}{% endblocktrans %}</p>
<p>
<a href="{{ user.local_path }}/followers">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
<a href="{{ user.local_path }}/following">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
{% if is_self %}
<a href="{% url 'user-followers' user|username %}">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
<a href="{% url 'user-following' user|username %}">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
{% elif request.user.is_authenticated %}
{% mutuals_count user as mutuals %}
<a href="{% url 'user-followers' user|username %}">
{% blocktrans with mutuals_display=mutuals|intcomma count counter=mutuals %}{{ mutuals_display }} follower you follow{% plural %}{{ mutuals_display }} followers you follow{% endblocktrans %}
</a>
{% endif %}
</p>
</div>
</div>