moviewyrm/fedireads/templates/user.html

121 lines
3.4 KiB
HTML
Raw Normal View History

2020-01-26 20:14:27 +00:00
{% extends 'layout.html' %}
2020-01-29 23:10:32 +00:00
{% load humanize %}
{% load fr_display %}
2020-01-26 20:14:27 +00:00
{% block content %}
2020-01-29 23:10:32 +00:00
<div id="sidebar">
2020-01-26 20:14:27 +00:00
<div class="user-profile">
2020-01-29 23:10:32 +00:00
<h2>
{% include 'snippets/avatar.html' with user=user %}
2020-01-29 23:10:32 +00:00
{% if user.name %}{{ user.name }}{% endif %}
<small>{{ user.username }}</small>
</h2>
2020-01-29 07:23:05 +00:00
{% if user.summary %}
<blockquote>{{ user.summary | safe }}</blockquote>
2020-01-29 07:23:05 +00:00
{% endif %}
2020-01-26 20:14:27 +00:00
{% if not is_self %}
2020-01-29 23:10:32 +00:00
{% if not request.user in user.followers.all %}
<form action="/follow/{{ user.username }}" method="post">
2020-01-29 23:10:32 +00:00
{% csrf_token %}
2020-01-26 20:14:27 +00:00
<input type="submit" value="Follow"></input>
</form>
{% else %}
<form action="/unfollow/{{ user.username }}" method="post">
2020-01-29 23:10:32 +00:00
{% csrf_token %}
2020-01-26 20:14:27 +00:00
<input type="submit" value="Unfollow"></input>
</form>
{% endif %}
{% endif %}
2020-01-27 02:49:57 +00:00
2020-01-29 23:10:32 +00:00
{% if is_self %}
<div class="interaction">
<a href="/user/{{ user.localname }}/edit">Edit profile</a>
2020-01-27 02:49:57 +00:00
</div>
2020-01-29 23:10:32 +00:00
{% endif %}
2020-01-27 02:49:57 +00:00
</div>
<div>
<h2>Followers</h2>
{% for follower in user.followers.all %}
2020-01-27 06:47:32 +00:00
<div>
<a href="{{ follower.actor }}">{{ follower.username }}</a>
2020-01-29 23:10:32 +00:00
{% if not request.user in follower.followers.all %}
2020-01-27 06:47:32 +00:00
<form action="/follow/" method="post">
2020-01-29 23:10:32 +00:00
{% csrf_token %}
2020-01-27 06:47:32 +00:00
<input type="hidden" name="user" value="{{ follower.id }}"></input>
<input type="submit" value="Follow"></input>
</form>
2020-01-29 23:10:32 +00:00
{% else %}
<form action="/unfollow/" method="post">
{% csrf_token %}
<input type="hidden" name="user" value="{{ follower.id }}"></input>
<input type="submit" value="Unfollow"></input>
</form>
{% endif %}
2020-01-27 06:47:32 +00:00
</div>
2020-01-27 02:49:57 +00:00
{% endfor %}
2020-01-26 20:14:27 +00:00
</div>
2020-01-29 23:10:32 +00:00
</div>
2020-01-26 20:14:27 +00:00
2020-01-29 23:10:32 +00:00
<div id="content">
{% for shelf in shelves %}
<div>
2020-01-29 23:32:43 +00:00
<h2>{{ shelf.name }}</h2>
2020-01-29 23:10:32 +00:00
{% if shelf.books %}
<table>
<tr class="book-preview">
<th>
Cover
</th>
<th>
Title
</th>
<th>
Author
</th>
<th>
Published
</th>
<th>
Shelved
</th>
<th>
External links
</th>
<th>
Rating
</th>
</tr>
{% for book in shelf.books.all %}
<tr class="book-preview">
<td>
2020-02-19 07:03:04 +00:00
{% include 'snippets/book_cover.html' with book=book %}
2020-01-29 23:10:32 +00:00
</td>
<td>
2020-02-18 01:53:40 +00:00
<a href="/book/{{ book.openlibrary_key }}">{{ book.data.title }}</a>
2020-01-29 23:10:32 +00:00
</td>
<td>
{{ book.authors.first.data.name }}
</td>
<td>
{{ book.data.first_publish_date }}
</td>
<td>
{{ book.added_date | naturalday }}
</td>
<td>
<a href="https://openlibrary.org{{ book.data.key }}" target="_blank">OpenLibrary</a>
</td>
<td>
{{ ratings | dict_key:book.id | stars}}
</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>This shelf is empty.</p>
{% endif %}
</div>
{% endfor %}
2020-01-26 20:14:27 +00:00
</div>
2020-01-29 23:10:32 +00:00
2020-01-26 20:14:27 +00:00
{% endblock %}