forked from mirrors/bookwyrm
Book editing
This commit is contained in:
parent
24d9839d07
commit
2d89d4abf8
7 changed files with 97 additions and 90 deletions
|
@ -16,6 +16,7 @@ class CustomForm(ModelForm):
|
||||||
css_classes['text'] = 'input'
|
css_classes['text'] = 'input'
|
||||||
css_classes['password'] = 'input'
|
css_classes['password'] = 'input'
|
||||||
css_classes['email'] = 'input'
|
css_classes['email'] = 'input'
|
||||||
|
css_classes['number'] = 'input'
|
||||||
css_classes['checkbox'] = 'checkbox'
|
css_classes['checkbox'] = 'checkbox'
|
||||||
css_classes['textarea'] = 'textarea'
|
css_classes['textarea'] = 'textarea'
|
||||||
super(CustomForm, self).__init__(*args, **kwargs)
|
super(CustomForm, self).__init__(*args, **kwargs)
|
||||||
|
@ -118,6 +119,7 @@ class EditionForm(CustomForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Edition
|
model = models.Edition
|
||||||
exclude = [
|
exclude = [
|
||||||
|
'remote_id',
|
||||||
'created_date',
|
'created_date',
|
||||||
'updated_date',
|
'updated_date',
|
||||||
'last_sync_date',
|
'last_sync_date',
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content-container">
|
|
||||||
<h2>About {{ site_settings.name }}</h2>
|
|
||||||
<p>
|
|
||||||
{{ site_settings.instance_description }}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<div class="columns">
|
||||||
<small>
|
<div class="column block">
|
||||||
<a href="/login/">Login or Create an Account</a>
|
<h2 class="title">About {{ site_settings.name }}</h2>
|
||||||
</small>
|
<p>
|
||||||
</p>
|
{{ site_settings.instance_description }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Code of Conduct</h2>
|
<div class="column block">
|
||||||
<p>
|
<h2 class="title">Code of Conduct</h2>
|
||||||
{{ site_settings.code_of_conduct }}
|
<p>
|
||||||
</p>
|
{{ site_settings.code_of_conduct }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
<span>{% include 'snippets/book_titleby.html' with book=book %}</span>
|
<span>{% include 'snippets/book_titleby.html' with book=book %}</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
<a href="{{ book.id }}/edit">edit
|
<a href="{{ book.id }}/edit">edit
|
||||||
<span class="icon icon-pencil">
|
<span class="icon icon-pencil">
|
||||||
<span class="hidden-text">Edit Book</span>
|
<span class="hidden-text">Edit Book</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column">
|
<div class="column is-narrow">
|
||||||
{% include 'snippets/book_cover.html' with book=book size=large %}
|
{% include 'snippets/book_cover.html' with book=book size=large %}
|
||||||
{% include 'snippets/rate_action.html' with user=request.user book=book %}
|
{% include 'snippets/rate_action.html' with user=request.user book=book %}
|
||||||
{% include 'snippets/shelve_button.html' %}
|
{% include 'snippets/shelve_button.html' %}
|
||||||
|
@ -43,9 +43,9 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column is-three-quarters">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h3>{% include 'snippets/stars.html' with rating=rating %}</h3>
|
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ reviews|length }} reviews)</h3>
|
||||||
|
|
||||||
{% include 'snippets/book_description.html' %}
|
{% include 'snippets/book_description.html' %}
|
||||||
|
|
||||||
|
|
|
@ -1,71 +1,83 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content-container">
|
<div class="block">
|
||||||
<h2>
|
<div class="level">
|
||||||
Edit "{{ book.title }}"
|
<h2 class="title level-left">
|
||||||
<a href="/book/{{ book.id }}">
|
Edit "{{ book.title }}"
|
||||||
<span class="edit-link icon icon-close">
|
</h2>
|
||||||
<span class="hidden-text">Close</span>
|
<div class="level-right">
|
||||||
</span>
|
<a href="/book/{{ book.id }}">
|
||||||
</a>
|
<span class="edit-link icon icon-close">
|
||||||
</h2>
|
<span class="hidden-text">Close</span>
|
||||||
<div class="book-preview row">
|
</span>
|
||||||
<div class="cover-container">
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-narrow">
|
||||||
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="column is-narrow">
|
||||||
<p>Added: {{ book.created_date | naturaltime }}</p>
|
<p>Added: {{ book.created_date | naturaltime }}</p>
|
||||||
<p>Updated: {{ book.updated_date | naturaltime }}</p>
|
<p>Updated: {{ book.updated_date | naturaltime }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="book-form content-container" name="edit-book" action="/edit_book/{{ book.id }}" method="post" enctype="multipart/form-data">
|
<form class="block" name="edit-book" action="/edit_book/{{ book.id }}" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h3>Data sync
|
<div class="block">
|
||||||
<small>If sync is enabled, any changes will be over-written</small>
|
<h3 class="title is-4">Data sync</h3>
|
||||||
</h3>
|
<h4 class="subtitle is-5">If sync is enabled, any changes will be over-written</h4>
|
||||||
<div>
|
</h3>
|
||||||
<div class="row">
|
<div class="columns">
|
||||||
<p><label for="id_sync">Sync:</label> <input type="checkbox" name="sync" id="id_sync"></p>
|
<div class="column is-narrow">
|
||||||
<p><label for="id_sync_cover">Sync cover:</label> <input type="checkbox" name="sync_cover" id="id_sync_cover"></p>
|
<label class="checkbox" for="id_sync"><input class="checkbox" type="checkbox" name="sync" id="id_sync"> Sync</label>
|
||||||
|
</div>
|
||||||
|
<div class="column is-narrow">
|
||||||
|
<label class="checkbox" for="id_sync_cover"><input class="checkbox" type="checkbox" name="sync_cover" id="id_sync_cover"> Sync cover</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3>Cover</h3>
|
<div class="columns">
|
||||||
<div class="image-form">
|
<div class="block column">
|
||||||
<p>{{ form.cover }} </p>
|
<h3 class="title is-4">Book Identifiers</h3>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_isbn_13">ISBN 13:</label> {{ form.isbn_13 }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_isbn_10">ISBN 10:</label> {{ form.isbn_10 }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_openlibrary_key">Openlibrary key:</label> {{ form.openlibrary_key }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_librarything_key">Librarything key:</label> {{ form.librarything_key }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_goodreads_key">Goodreads key:</label> {{ form.goodreads_key }} </p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="column">
|
||||||
|
<div class="block">
|
||||||
|
<h3 class="title is-4">Cover</h3>
|
||||||
|
<p>{{ form.cover }} </p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<h3 class="title is-4">Physical Properties</h3>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_physical_format">Format:</label> {{ form.physical_format }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_pages">Pages:</label> {{ form.pages }} </p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3>Book Identifiers</h2>
|
<div class="block">
|
||||||
<div>
|
<h3 class="title is-4">Metadata</h3>
|
||||||
<p><label for="id_isbn_13">ISBN 13:</label> {{ form.isbn_13 }} </p>
|
<p class="fields is-grouped"><label class="label"for="id_title">Title:</label> {{ form.title }} </p>
|
||||||
<p><label for="id_isbn_10">ISBN 10:</label> {{ form.isbn_10 }} </p>
|
<p class="fields is-grouped"><label class="label"for="id_sort_title">Sort title:</label> {{ form.sort_title }} </p>
|
||||||
<p><label for="id_openlibrary_key">Openlibrary key:</label> {{ form.openlibrary_key }} </p>
|
<p class="fields is-grouped"><label class="label"for="id_subtitle">Subtitle:</label> {{ form.subtitle }} </p>
|
||||||
<p><label for="id_librarything_key">Librarything key:</label> {{ form.librarything_key }} </p>
|
<p class="fields is-grouped"><label class="label"for="id_description">Description:</label> {{ form.description }} </p>
|
||||||
<p><label for="id_goodreads_key">Goodreads key:</label> {{ form.goodreads_key }} </p>
|
<p class="fields is-grouped"><label class="label"for="id_series">Series:</label> {{ form.series }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_series_number">Series number:</label> {{ form.series_number }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_first_published_date">First published date:</label> {{ form.first_published_date }} </p>
|
||||||
|
<p class="fields is-grouped"><label class="label"for="id_published_date">Published date:</label> {{ form.published_date }} </p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="block">
|
||||||
<h3>Physical Properties</h3>
|
<button class="button is-primary" type="submit">Save</button>
|
||||||
<div>
|
|
||||||
<p><label for="id_physical_format">Format:</label> {{ form.physical_format }} </p>
|
|
||||||
<p><label for="id_pages">Pages:</label> {{ form.pages }} </p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>Metadata</h3>
|
|
||||||
<div>
|
|
||||||
<p><label for="id_title">Title:</label> {{ form.title }} </p>
|
|
||||||
<p><label for="id_sort_title">Sort title:</label> {{ form.sort_title }} </p>
|
|
||||||
<p><label for="id_subtitle">Subtitle:</label> {{ form.subtitle }} </p>
|
|
||||||
<p><label for="id_description">Description:</label> {{ form.description }} </p>
|
|
||||||
<p><label for="id_series">Series:</label> {{ form.series }} </p>
|
|
||||||
<p><label for="id_series_number">Series number:</label> {{ form.series_number }} </p>
|
|
||||||
<p><label for="id_first_published_date">First published date:</label> {{ form.first_published_date }} </p>
|
|
||||||
<p><label for="id_published_date">Published date:</label> {{ form.published_date }} </p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="submit">Save</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content-container">
|
<div class="block">
|
||||||
<div class="user-profile">
|
<h2 class="title">Edit Profile</h2>
|
||||||
<h2>Edit Profile</h2>
|
<form name="avatar" action="/edit_profile/" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
<p>{% include 'snippets/avatar.html' with user=user %} {% if user.localname %}{{ user.localname }}{% else %}{{ user.username }}{% endif %}</p>
|
{{ form.as_p }}
|
||||||
|
<button class="button is-primary" type="submit">Update profile</button>
|
||||||
<form name="avatar" action="/edit_profile/" method="post" enctype="multipart/form-data">
|
</form>
|
||||||
{% csrf_token %}
|
|
||||||
{{ form.as_p }}
|
|
||||||
<button type="submit">Update profile</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -144,7 +144,7 @@ def resolve_book(request):
|
||||||
def edit_book(request, book_id):
|
def edit_book(request, book_id):
|
||||||
''' edit a book cool '''
|
''' edit a book cool '''
|
||||||
if not request.method == 'POST':
|
if not request.method == 'POST':
|
||||||
return redirect('/book/%s' % request.user.localname)
|
return redirect('/book/%s' % book_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
book = models.Edition.objects.get(id=book_id)
|
book = models.Edition.objects.get(id=book_id)
|
||||||
|
|
|
@ -458,7 +458,6 @@ def book_page(request, book_id, tab='friends'):
|
||||||
{'id': 'local', 'display': 'Local'},
|
{'id': 'local', 'display': 'Local'},
|
||||||
{'id': 'federated', 'display': 'Federated'}
|
{'id': 'federated', 'display': 'Federated'}
|
||||||
],
|
],
|
||||||
'active_tab': tab,
|
|
||||||
'path': '/book/%s' % book_id,
|
'path': '/book/%s' % book_id,
|
||||||
'cover_form': forms.CoverForm(instance=book),
|
'cover_form': forms.CoverForm(instance=book),
|
||||||
'info_fields': [
|
'info_fields': [
|
||||||
|
|
Loading…
Reference in a new issue