Refactors user pages
This commit is contained in:
36
bookwyrm/templates/user/followers.html
Normal file
36
bookwyrm/templates/user/followers.html
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends 'user/user_layout.html' %}
|
||||
{% load bookwyrm_tags %}
|
||||
|
||||
{% block header %}
|
||||
<h1 class="title">
|
||||
{% if is_self %}Your
|
||||
{% else %}
|
||||
{% include 'snippets/username.html' with user=user possessive=True %}
|
||||
{% endif %}
|
||||
followers
|
||||
</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<div class="block">
|
||||
<h2 class="title">Followers</h2>
|
||||
{% for followers in followers %}
|
||||
<div class="block">
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
{% include 'snippets/avatar.html' with user=followers %}
|
||||
</div>
|
||||
<div class="control">
|
||||
{% include 'snippets/username.html' with user=followers show_full=True %}
|
||||
</div>
|
||||
<div class="control">
|
||||
{% include 'snippets/follow_button.html' with user=followers %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not followers.count %}
|
||||
<div>{{ user|username }} has no followers</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
36
bookwyrm/templates/user/following.html
Normal file
36
bookwyrm/templates/user/following.html
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends 'user/user_layout.html' %}
|
||||
{% load bookwyrm_tags %}
|
||||
|
||||
{% block header %}
|
||||
<h1 class="title">
|
||||
Users following
|
||||
{% if is_self %}you
|
||||
{% else %}
|
||||
{% include 'snippets/username.html' with user=user %}
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<div class="block">
|
||||
<h2 class="title">Following</h2>
|
||||
{% for follower in user.following.all %}
|
||||
<div class="block">
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
{% include 'snippets/avatar.html' with user=follower %}
|
||||
</div>
|
||||
<div class="control">
|
||||
{% include 'snippets/username.html' with user=follower show_full=True %}
|
||||
</div>
|
||||
<div class="control">
|
||||
{% include 'snippets/follow_button.html' with user=follower %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not following.count %}
|
||||
<div>{{ user|username }} isn't following any users</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
74
bookwyrm/templates/user/user.html
Normal file
74
bookwyrm/templates/user/user.html
Normal file
@ -0,0 +1,74 @@
|
||||
{% extends 'user/user_layout.html' %}
|
||||
|
||||
{% block header %}
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<h1 class="title">User profile</h1>
|
||||
</div>
|
||||
{% if is_self %}
|
||||
<div class="column is-narrow">
|
||||
<a href="/edit-profile">
|
||||
<span class="icon icon-pencil" title="Edit profile">
|
||||
<span class="is-sr-only">Edit profile</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% if user.bookwyrm_user %}
|
||||
<div class="block">
|
||||
<h2 class="title">Shelves</h2>
|
||||
<div class="columns">
|
||||
{% for shelf in shelves %}
|
||||
<div class="column is-narrow">
|
||||
<h3>{{ shelf.name }}
|
||||
{% if shelf.size > 3 %}<small>(<a href="{{ shelf.local_path }}">See all {{ shelf.size }}</a>)</small>{% endif %}</h3>
|
||||
<div class="is-mobile field is-grouped">
|
||||
{% for book in shelf.books %}
|
||||
<div class="control">
|
||||
<a href="{{ book.local_path }}">
|
||||
{% include 'snippets/book_cover.html' with book=book size="medium" %}
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<small><a href="{{ user.local_path }}/shelves">See all {{ shelf_count }} shelves</a></small>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if goal %}
|
||||
<div class="block">
|
||||
<h2 class="title">{% now 'Y' %} Reading Goal</h2>
|
||||
{% include 'snippets/goal_progress.html' with goal=goal %}
|
||||
</div>
|
||||
{% elif user == request.user %}
|
||||
<div class="block">
|
||||
<h2 class="title is-4"><a href="{{ user.local_path }}/goal/{% now 'Y' %}">Set a reading goal for {% now 'Y' %}</a></h2>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<div class="block">
|
||||
<h2 class="title">User Activity</h2>
|
||||
</div>
|
||||
{% for activity in activities %}
|
||||
<div class="block" id="feed">
|
||||
{% include 'snippets/status.html' with status=activity %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not activities %}
|
||||
<div class="block">
|
||||
<p>No activities yet!</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'snippets/pagination.html' with page=activities path=user.local_path anchor="#feed" %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
72
bookwyrm/templates/user/user_layout.html
Normal file
72
bookwyrm/templates/user/user_layout.html
Normal file
@ -0,0 +1,72 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load bookwyrm_tags %}
|
||||
<header class="block">
|
||||
{% block header %}{% endblock %}
|
||||
</header>
|
||||
|
||||
{% block content %}
|
||||
{# user bio #}
|
||||
<div class="block">
|
||||
<div class="columns">
|
||||
<div class="column is-narrow">
|
||||
<div class="media">
|
||||
<div class="media-left">
|
||||
<a href="{{ user.local_path }}">
|
||||
{% include 'snippets/avatar.html' with user=user large=True %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p>{% if user.name %}{{ user.name }}{% else %}{{ user.localname }}{% endif %}</p>
|
||||
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
|
||||
<p>Joined {{ user.created_date | naturaltime }}</p>
|
||||
<p>
|
||||
<a href="{{ user.local_path }}/followers">{{ user.followers.count }} follower{{ user.followers.count | pluralize }}</a>,
|
||||
<a href="{{ user.local_path }}/following">{{ user.following.count }} following</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
{% if user.summary %}
|
||||
<div class="columns">
|
||||
<div class="column is-narrow">
|
||||
<span class="icon icon-quote-open"></span>
|
||||
</div>
|
||||
<div class="column">
|
||||
<blockquote>{{ user.summary | to_markdown | safe }}</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if not is_self %}
|
||||
<div class="field has-addons">
|
||||
<div class="control">
|
||||
{% include 'snippets/follow_button.html' with user=user %}
|
||||
</div>
|
||||
<div class="control">
|
||||
{% include 'snippets/user_options.html' with user=user class="is-small" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if is_self and user.follower_requests.all %}
|
||||
<div class="follow-requests">
|
||||
<h2>Follow Requests</h2>
|
||||
{% for requester in user.follower_requests.all %}
|
||||
<div class="row shrink">
|
||||
<p>
|
||||
{% include 'snippets/username.html' with user=requester show_full=True %}
|
||||
</p>
|
||||
{% include 'snippets/follow_request_buttons.html' with user=requester %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% block panel %}{% endblock %}
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user