2020-03-28 22:06:16 +00:00
|
|
|
{% extends 'layout.html' %}
|
2021-02-28 02:48:10 +00:00
|
|
|
{% load i18n %}
|
2020-03-30 00:02:17 +00:00
|
|
|
{% load humanize %}
|
2021-02-28 18:00:36 +00:00
|
|
|
|
2021-03-02 17:01:31 +00:00
|
|
|
{% block title %}{% if book %}{% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %}{% else %}{% trans "Add Book" %}{% endif %}{% endblock %}
|
2021-02-28 18:00:36 +00:00
|
|
|
|
2020-03-28 22:06:16 +00:00
|
|
|
{% block content %}
|
2021-01-14 22:13:23 +00:00
|
|
|
<header class="block">
|
|
|
|
<h1 class="title level-left">
|
2021-03-02 17:01:31 +00:00
|
|
|
{% if book %}
|
|
|
|
{% blocktrans with book_title=book.title %}Edit "{{ book.title }}"{% endblocktrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans "Add Book" %}
|
|
|
|
{% endif %}
|
2021-01-14 22:13:23 +00:00
|
|
|
</h1>
|
2020-11-09 20:35:18 +00:00
|
|
|
<div>
|
2021-02-28 02:48:10 +00:00
|
|
|
<p>{% trans "Added:" %} {{ book.created_date | naturaltime }}</p>
|
|
|
|
<p>{% trans "Updated:" %} {{ book.updated_date | naturaltime }}</p>
|
|
|
|
<p>{% trans "Last edited by:" %} <a href="{{ book.last_edited_by.remote_id }}">{{ book.last_edited_by.display_name }}</a></p>
|
2020-03-30 00:02:17 +00:00
|
|
|
</div>
|
2021-01-14 22:13:23 +00:00
|
|
|
</header>
|
2020-03-28 22:06:16 +00:00
|
|
|
|
2020-12-22 17:26:40 +00:00
|
|
|
{% if form.non_field_errors %}
|
2020-11-24 21:25:28 +00:00
|
|
|
<div class="block">
|
2020-12-22 17:26:40 +00:00
|
|
|
<p class="notification is-danger">{{ form.non_field_errors }}</p>
|
2020-11-24 21:25:28 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2020-11-24 21:37:35 +00:00
|
|
|
|
2021-03-04 21:48:50 +00:00
|
|
|
<form class="block" name="edit-book" action="{{ book.local_path }}/edit#deduplication" method="post" enctype="multipart/form-data">
|
|
|
|
<fieldset {% if confirm_mode %}disabled{% endif %}>
|
2020-03-30 00:02:17 +00:00
|
|
|
{% csrf_token %}
|
2020-12-22 17:26:40 +00:00
|
|
|
<input type="hidden" name="last_edited_by" value="{{ request.user.id }}">
|
2020-09-30 03:36:43 +00:00
|
|
|
<div class="columns">
|
2020-11-24 21:37:35 +00:00
|
|
|
<div class="column">
|
2021-03-02 17:01:31 +00:00
|
|
|
<section class="block">
|
|
|
|
<h2 class="title is-4">{% trans "Metadata" %}</h2>
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_title">{% trans "Title:" %}</label> {{ form.title }} </p>
|
|
|
|
{% for error in form.title.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_subtitle">{% trans "Subtitle:" %}</label> {{ form.subtitle }} </p>
|
|
|
|
{% for error in form.subtitle.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_description">{% trans "Description:" %}</label> {{ form.description }} </p>
|
|
|
|
{% for error in form.description.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_series">{% trans "Series:" %}</label> {{ form.series }} </p>
|
|
|
|
{% for error in form.series.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_series_number">{% trans "Series number:" %}</label> {{ form.series_number }} </p>
|
|
|
|
{% for error in form.series_number.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_first_published_date">{% trans "First published date:" %}</label> {{ form.first_published_date }} </p>
|
|
|
|
{% for error in form.first_published_date.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_published_date">{% trans "Published date:" %}</label> {{ form.published_date }} </p>
|
|
|
|
{% for error in form.published_date.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="block">
|
|
|
|
<h2 class="title is-4">{% trans "Authors" %}</h2>
|
|
|
|
{% for author in book.authors.all %}
|
|
|
|
<p><a href="{{ author.local_path }}">{{ author.name }}</a>
|
|
|
|
<label class="label">
|
2021-03-04 21:48:50 +00:00
|
|
|
<input type="checkbox" name="remove_author" value="{{ author.id }}"> {% trans "Remove this author" %}
|
2021-03-02 17:01:31 +00:00
|
|
|
</label>
|
|
|
|
{% endfor %}
|
|
|
|
<label class="label" for="id_add_author">{% trans "Add Author:" %}</label>
|
2021-03-04 21:48:50 +00:00
|
|
|
<input class="input" type="text" name="add_author" id="id_add_author" placeholder="John Doe" value="{{ add_author }}">
|
2021-03-02 17:01:31 +00:00
|
|
|
</section>
|
2020-09-30 03:36:43 +00:00
|
|
|
</div>
|
2020-03-30 00:02:17 +00:00
|
|
|
|
2020-09-30 03:36:43 +00:00
|
|
|
<div class="column">
|
2020-11-09 20:35:18 +00:00
|
|
|
<div class="columns">
|
|
|
|
<div class="column is-narrow">
|
|
|
|
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
|
|
|
</div>
|
|
|
|
<div class="column is-narrow">
|
|
|
|
<div class="block">
|
2021-02-28 02:48:10 +00:00
|
|
|
<h2 class="title is-4">{% trans "Cover" %}</h2>
|
2021-02-23 21:23:41 +00:00
|
|
|
<p>{{ form.cover }}</p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.cover.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2020-11-09 20:35:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-30 03:36:43 +00:00
|
|
|
</div>
|
2020-03-30 00:02:17 +00:00
|
|
|
|
2020-09-30 03:36:43 +00:00
|
|
|
<div class="block">
|
2021-02-28 02:48:10 +00:00
|
|
|
<h2 class="title is-4">{% trans "Physical Properties" %}</h2>
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_physical_format">{% trans "Format:" %}</label> {{ form.physical_format }} </p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.physical_format.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
{% for error in form.physical_format.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
|
2021-02-28 02:48:10 +00:00
|
|
|
<p class="fields is-grouped"><label class="label" for="id_pages">{% trans "Pages:" %}</label> {{ form.pages }} </p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.pages.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="block">
|
2021-02-28 02:48:10 +00:00
|
|
|
<h2 class="title is-4">{% trans "Book Identifiers" %}</h2>
|
|
|
|
<p class="fields is-grouped"><label class="label" for="id_isbn_13">{% trans "ISBN 13:" %}</label> {{ form.isbn_13 }} </p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.isbn_13.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2021-02-28 02:48:10 +00:00
|
|
|
<p class="fields is-grouped"><label class="label" for="id_isbn_10">{% trans "ISBN 10:" %}</label> {{ form.isbn_10 }} </p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.isbn_10.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2021-02-28 02:48:10 +00:00
|
|
|
<p class="fields is-grouped"><label class="label" for="id_openlibrary_key">{% trans "Openlibrary key:" %}</label> {{ form.openlibrary_key }} </p>
|
2020-11-24 21:37:35 +00:00
|
|
|
{% for error in form.openlibrary_key.errors %}
|
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2021-02-28 02:48:10 +00:00
|
|
|
<p class="fields is-grouped"><label class="label" for="id_librarything_key">{% trans "OCLC Number:" %}</label> {{ form.oclc_number }} </p>
|
2021-01-05 00:42:28 +00:00
|
|
|
{% for error in form.oclc_number.errors %}
|
2020-11-24 21:37:35 +00:00
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2021-02-28 02:48:10 +00:00
|
|
|
<p class="fields is-grouped"><label class="label" for="id_asin">{% trans "ASIN:" %}</label> {{ form.asin }} </p>
|
2021-01-05 00:42:28 +00:00
|
|
|
{% for error in form.ASIN.errors %}
|
2020-11-24 21:37:35 +00:00
|
|
|
<p class="help is-danger">{{ error | escape }}</p>
|
|
|
|
{% endfor %}
|
2020-09-30 03:36:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-02 15:44:53 +00:00
|
|
|
</div>
|
|
|
|
|
2020-09-30 03:36:43 +00:00
|
|
|
<div class="block">
|
2021-02-28 02:48:10 +00:00
|
|
|
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
|
|
|
|
<a class="button" href="/book/{{ book.id }}">{% trans "Cancel" %}</a>
|
2020-04-04 20:46:10 +00:00
|
|
|
</div>
|
2021-03-04 21:48:50 +00:00
|
|
|
</fieldset>
|
2020-03-30 00:02:17 +00:00
|
|
|
</form>
|
2020-03-28 22:06:16 +00:00
|
|
|
|
2021-03-04 21:48:50 +00:00
|
|
|
{% if author_matches or book_matches %}
|
|
|
|
<hr class="block">
|
|
|
|
<form class="box content" id="deduplication">
|
|
|
|
<h2 class="title is-4">{% trans "Confirm Book Info" %}</h2>
|
|
|
|
<div class="columns">
|
|
|
|
{% if author_matches.exists %}
|
|
|
|
<fieldset class="column is-half">
|
|
|
|
<legend class="label">{% blocktrans %}Is "{{ add_author }}" an existing author?{% endblocktrans %}</legend>
|
|
|
|
{% for match in author_matches %}
|
|
|
|
<label class="label"><input type="radio" name="author_match" value="{{ match.id }}"> {{ match.name }}</label>
|
|
|
|
<p class="help">
|
|
|
|
<a href="{{ author.local_path }}" target="_blank">{% blocktrans with book_title=match.book_set.first.title %}Author of <em>{{ book_title }}</em>{% endblocktrans %}</a>
|
|
|
|
</p>
|
|
|
|
{% endfor %}
|
|
|
|
<label class="label"><input type="radio" name="author_match"> this is a new author</label>
|
|
|
|
</fieldset>
|
|
|
|
{% else %}
|
|
|
|
<p class="column is-half">{% blocktrans %}Creating a new author: {{ add_author }}{% endblocktrans %}</p>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if not book %}
|
|
|
|
<fieldset class="column is-half">
|
|
|
|
<legend class="title is-5">{% trans "Is this an editions of an existing work?" %}</legend>
|
|
|
|
{% for match in book_matches %}
|
|
|
|
<label class="label"><input type="radio" name="book_match" value="{{ match.id }}"> {{ match.title }}</label>
|
|
|
|
{% endfor %}
|
|
|
|
<label class="label"><input type="radio" name="book_match"> this is a new work</label>
|
|
|
|
</fieldset>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button class="button is-primary" type="submit">{% trans "save" %}</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-03-28 22:06:16 +00:00
|
|
|
{% endblock %}
|