1
0
Fork 0

Edit books

Fixes #109
This commit is contained in:
Mouse Reeve 2020-03-28 15:06:16 -07:00
parent 16fec1b6d5
commit 1a33290267
11 changed files with 281 additions and 44 deletions

View file

@ -1,9 +1,18 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
<div class="content-container">
<div class="content-container user-profile">
<h2><q>{{ book.title }}</q> by
{% include 'snippets/authors.html' with book=book %}</h2>
{% include 'snippets/authors.html' with book=book %}
{% if request.user.is_authenticated %}
<a href="{{ book.fedireads_key }}/edit" class="edit-link">edit
<span class="icon icon-pencil">
<span class="hidden-text">Edit Book</span>
</span>
</a>
{% endif %}
</h2>
<div>
{% if book.parent_work %}<p>Edition of <a href="/book/{{ book.parent_work.fedireads_key }}">{{ book.parent_work.title }}</a></p>{% endif %}
<div class="book-preview">
@ -24,6 +33,15 @@
{% include 'snippets/shelve_button.html' %}
</div>
<div>
{% if request.user.is_authenticated and not book.cover %}
<form name="add-cover" method="POST" action="/upload_cover/{{book.id}}" enctype="multipart/form-data">
{% csrf_token %}
{{ cover_form.as_p }}
<button type="submit">Add cover</button>
</form>
{% endif %}
</div>
</div>
</div>

View file

@ -0,0 +1,15 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-container">
<h2>Edit "{{ book.title }}"</h2>
<p class="book-cover">{% include 'snippets/book_cover.html' with book=book %}</p>
<form name="edit-book" action="/edit_book/{{ book.id }}" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Update book</button>
</form>
</div>
{% endblock %}

View file

@ -1,8 +1,11 @@
{% extends 'layout.html' %}
{% block content %}
<div id="content">
<div class="content-container">
<div class="user-profile">
<h1>{% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}</h1>
<h2>Edit Profile</h2>
<p>{% include 'snippets/avatar.html' with user=user %} {% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}</p>
<form name="avatar" action="/edit_profile/" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}

View file

@ -2,8 +2,8 @@
{% load fr_display %}
<div class="content-container user-profile">
<h2>User Profile
{% if is_self %}
<a href="/user-edit/">edit
{% if is_self %}
<a href="/user-edit/" class="edit-link">edit
<span class="icon icon-pencil">
<span class="hidden-text">Edit profile</span>
</span>