1
0
Fork 0
This commit is contained in:
Mouse Reeve 2020-01-29 00:05:58 -08:00
parent 789b9a1dc0
commit f3330ab6e7
9 changed files with 58 additions and 24 deletions

View file

@ -3,7 +3,7 @@
<div id="content">
<div>
<div class="book-preview">
<img class="book-cover" src="/static/images/med.jpg">
<img class="book-cover" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<h1>{{ book.data.title }}</h1>
by {{ book.authors.first.data.name }}
{{ rating }} stars

View file

@ -3,7 +3,6 @@
<div id="content">
<div class="user-profile">
<h1>{% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}</h1>
<img class="user-pic" src="/static/images/profile.jpg">
<form name="avatar" action="/edit_profile/" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}

View file

@ -4,18 +4,24 @@
<div>
<h2>Currently Reading</h2>
{# listing books currently on user's shelves #}
{% if not shelves.first.books.all %}
{% if not reading.books.all %}
<p>Start a book!</p>
{% endif %}
{% for book in shelves.first.books.all %}
{% for book in to_read.books.all %}
<div class="book-preview">
<img class="cover" src="static/images/small.jpg">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title"><a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a></p>
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
<button>start reading</button>
</div>
{% endfor %}
{% endif %}
{% for book in reading.books.all %}
<div class="book-preview">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title"><a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a></p>
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
{% if shelf.type == 'reading' %}
{# TODO: re-shelve a book #}
<button>done reading</button>
{% endif %}
</div>
{% endfor %}
</div>
@ -24,7 +30,7 @@
<h2>Recently Added Books</h2>
{% for book in recent_books %}
<div class="book-preview">
<img class="cover" src="static/images/small.jpg">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a>
by
@ -65,7 +71,7 @@
</h2>
{# TODO: wouldn't it rule if this was a reusable piece of markup? #}
<div class="book-preview">
<img class="cover" src="static/images/med.jpg">
<img class="book-cover" src="{% if activity.book.cover %}/images/{{ activity.book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ activity.book.openlibrary_key }}">{{ activity.book.data.title }}</a>
by
@ -77,7 +83,7 @@
reviewed {{ activity.book.data.title }}
</h2>
<div class="book-preview review">
<img class="cover" src="static/images/med.jpg">
<img class="book-cover" src="{% if activity.book.cover %}/images/{{ activity.book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ activity.book.openlibrary_key }}">{{ activity.book.data.title }}</a>
by

View file

@ -27,7 +27,7 @@
<div id="account">
{% if user.is_authenticated %}
<form name="logout" action="/logout/" method="post">
Welcome, <a href="{{ request.user.actor }}">{% if request.user.localname %}{{ request.user.localname }}{% else %}{{ request.user.username }}{% endif %}</a>
Welcome, <a href="/user/{{ request.user.localname }}">{{ request.user.localname }}</a>
<input type="submit" value="Log out"></input>
</form>
{% else %}