mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Snippets for book previews, username links, avatars
This commit is contained in:
parent
3ba76a8b13
commit
f9cb9f939a
7 changed files with 15 additions and 14 deletions
|
@ -4,7 +4,7 @@
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div>
|
<div>
|
||||||
<div class="book-preview">
|
<div class="book-preview">
|
||||||
{% include 'book_snippet.html' with book=book size=large rating=rating description=True %}
|
{% include 'snippets/book.html' with book=book size=large rating=rating description=True %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="reviews">
|
<div class="reviews">
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
{% for review in reviews %}
|
{% for review in reviews %}
|
||||||
<div class="review">
|
<div class="review">
|
||||||
<h4>{{ review.name }}
|
<h4>{{ review.name }}
|
||||||
<small>{{ review.rating | stars }} stars, by {{ review.user.username }}</small>
|
<small>{{ review.rating | stars }} stars, by {% include 'snippets/username.html' with user=review.user %}</small>
|
||||||
</h4>
|
</h4>
|
||||||
<blockquote>{{ review.review_content }}</blockquote>
|
<blockquote>{{ review.review_content }}</blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<p>Start a book!</p>
|
<p>Start a book!</p>
|
||||||
{% for book in to_read.books.all %}
|
{% for book in to_read.books.all %}
|
||||||
<div class="book-preview">
|
<div class="book-preview">
|
||||||
{% include 'book_snippet.html' with book=book size="small" %}
|
{% include 'snippets/book.html' with book=book size="small" %}
|
||||||
<form name="shelve" action="/shelve/{{ user.localname }}_currently-reading/{{ book.id }}" method="post">
|
<form name="shelve" action="/shelve/{{ user.localname }}_currently-reading/{{ book.id }}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="book.id"></input>
|
<input type="hidden" name="book" value="book.id"></input>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
{% for book in reading.books.all %}
|
{% for book in reading.books.all %}
|
||||||
<div class="book-preview">
|
<div class="book-preview">
|
||||||
{% include 'book_snippet.html' with book=book size="small" %}
|
{% include 'snippets/book.html' with book=book size="small" %}
|
||||||
<form name="shelve" action="/shelve/{{ user.localname }}_read/{{ book.id }}" method="post">
|
<form name="shelve" action="/shelve/{{ user.localname }}_read/{{ book.id }}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="book.id"></input>
|
<input type="hidden" name="book" value="book.id"></input>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<h2>Recently Added Books</h2>
|
<h2>Recently Added Books</h2>
|
||||||
{% for book in recent_books %}
|
{% for book in recent_books %}
|
||||||
<div class="book-preview">
|
<div class="book-preview">
|
||||||
{% include 'book_snippet.html' with book=book size="small" %}
|
{% include 'snippets/book.html' with book=book size="small" %}
|
||||||
{% if not book in user_books.all %}
|
{% if not book in user_books.all %}
|
||||||
<form name="shelve" action="/shelve/{{ user.localname }}_to-read/{{ book.id }}" method="post">
|
<form name="shelve" action="/shelve/{{ user.localname }}_to-read/{{ book.id }}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -53,10 +53,8 @@
|
||||||
{% for activity in activities %}
|
{% for activity in activities %}
|
||||||
<div class="update">
|
<div class="update">
|
||||||
<h2>
|
<h2>
|
||||||
<img class="user-pic" src="{% if activity.user.avatar %}/images/{{ activity.user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
{% include 'snippets/avatar.html' with user=activity.user %}
|
||||||
{# TODO: a helper function for displaying a username #}
|
{% include 'snippets/username.html' with user=activity.user %}
|
||||||
<a href="/user/{% if activity.user.localname %}{{ activity.user.localname }}{% else %}{{ activity.user.username }}{% endif %}" class="user">
|
|
||||||
{% if activity.user.localname %}{{ activity.user.localname }}{% else %}{{ activity.user.username }}{% endif %}</a>
|
|
||||||
{% if activity.fedireads_type == 'Shelve' %}
|
{% if activity.fedireads_type == 'Shelve' %}
|
||||||
{# display a reading/shelving activity #}
|
{# display a reading/shelving activity #}
|
||||||
{% if activity.shelf.shelf_type == 'to-read' %}
|
{% if activity.shelf.shelf_type == 'to-read' %}
|
||||||
|
@ -69,9 +67,8 @@
|
||||||
shelved in "{{ activity.shelf.name }}"
|
shelved in "{{ activity.shelf.name }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
{# TODO: wouldn't it rule if this was a reusable piece of markup? #}
|
|
||||||
<div class="book-preview">
|
<div class="book-preview">
|
||||||
{% include 'book_snippet.html' with book=activity.book size=large description=True %}
|
{% include 'snippets/book.html' with book=activity.book size=large description=True %}
|
||||||
</div>
|
</div>
|
||||||
<div class="interaction"><button>⭐️ Like</button></div>
|
<div class="interaction"><button>⭐️ Like</button></div>
|
||||||
{% elif activity.fedireads_type == 'Review' %}
|
{% elif activity.fedireads_type == 'Review' %}
|
||||||
|
@ -79,7 +76,7 @@
|
||||||
reviewed {{ activity.book.data.title }}
|
reviewed {{ activity.book.data.title }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="book-preview review">
|
<div class="book-preview review">
|
||||||
{% include 'book_snippet.html' with book=activity.book size=large %}
|
{% include 'snippets/book.html' with book=activity.book size=large %}
|
||||||
|
|
||||||
<h3>{{ activity.name }}</h3>
|
<h3>{{ activity.name }}</h3>
|
||||||
<p>{{ activity.rating | stars }}</p>
|
<p>{{ activity.rating | stars }}</p>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<form name="logout" action="/logout/" method="post">
|
<form name="logout" action="/logout/" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
Welcome, <a href="/user/{{ request.user.localname }}">{{ request.user.localname }}</a>
|
Welcome, {% include 'snippets/username.html' %}
|
||||||
<input type="submit" value="Log out"></input>
|
<input type="submit" value="Log out"></input>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
2
fedireads/templates/snippets/avatar.html
Normal file
2
fedireads/templates/snippets/avatar.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<img class="user-pic" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
||||||
|
|
2
fedireads/templates/snippets/username.html
Normal file
2
fedireads/templates/snippets/username.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<a href="/user/{% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}" class="user">{% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div class="user-profile">
|
<div class="user-profile">
|
||||||
<h2>
|
<h2>
|
||||||
<img class="user-pic" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
{% include 'snippets/avatar.html' with user=user %}
|
||||||
{% if user.name %}{{ user.name }}{% endif %}
|
{% if user.name %}{{ user.name }}{% endif %}
|
||||||
<small>{{ user.username }}</small>
|
<small>{{ user.username }}</small>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
Loading…
Reference in a new issue