Full add author flow
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
<header class="block">
|
||||
<h1 class="title level-left">
|
||||
{% if book %}
|
||||
{% blocktrans with book_title=book.title %}Edit "{{ book.title }}"{% endblocktrans %}
|
||||
{% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans "Add Book" %}
|
||||
{% endif %}
|
||||
@ -26,9 +26,46 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form class="block" name="edit-book" action="{{ book.local_path }}/edit#deduplication" method="post" enctype="multipart/form-data">
|
||||
<fieldset {% if confirm_mode %}disabled{% endif %}>
|
||||
<form class="block" name="edit-book" action="{{ book.local_path }}/{% if confirm_mode %}confirm{% else %}edit{% endif %}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% if confirm_mode %}
|
||||
<div class="box">
|
||||
<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 with name=add_author %}Is "{{ name }}" an existing author?{% endblocktrans %}</legend>
|
||||
{% for match in author_matches %}
|
||||
<label><input type="radio" name="author_match" value="{{ match.id }}" required> {{ 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><input type="radio" name="author_match"> {% trans "This is a new author" %}</label>
|
||||
</fieldset>
|
||||
{% else %}
|
||||
<p class="column is-half">{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% 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="parent_work" value="{{ match.parent_work.id }}"> {{ match.parent_work.title }}</label>
|
||||
{% endfor %}
|
||||
<label><input type="radio" name="parent_work"> this is a new work</label>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<button class="button is-primary" type="submit">{% trans "Confirm" %}</button>
|
||||
<button class="button" type="button">{% trans "Back" %}</button>
|
||||
</div>
|
||||
|
||||
<hr class="block">
|
||||
{% endif %}
|
||||
|
||||
<fieldset>
|
||||
<input type="hidden" name="last_edited_by" value="{{ request.user.id }}">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
@ -72,8 +109,12 @@
|
||||
<input type="checkbox" name="remove_author" value="{{ author.id }}"> {% trans "Remove this author" %}
|
||||
</label>
|
||||
{% endfor %}
|
||||
{% if confirm_mode %}
|
||||
<input type="hidden" name="add_author" id="id_add_author" value="{{ add_author }}">
|
||||
{% else %}
|
||||
<label class="label" for="id_add_author">{% trans "Add Author:" %}</label>
|
||||
<input class="input" type="text" name="add_author" id="id_add_author" placeholder="John Doe" value="{{ add_author }}">
|
||||
<input class="input" type="text" name="add_author" id="id_add_author" placeholder="{% trans 'John Doe' %}" value="{{ add_author }}">
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@ -142,39 +183,4 @@
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user