populate new authors with isni data

If a user selects an author pulled from the ISNI service when editing a book, use any relevant data from ISNI to populate the new author record.

This includes
- bio
- aliases
- isni
- wikipedia url
- viaf
This commit is contained in:
Hugh Rundle
2021-10-31 17:58:15 +11:00
parent 45158a1c03
commit bce5f3f3b5
3 changed files with 119 additions and 47 deletions

View File

@ -50,39 +50,33 @@
<input type="hidden" name="author-match-count" value="{{ author_matches|length }}">
<div class="column is-half">
{% for author in author_matches %}
{% if author.isni_matches %}
<fieldset>
<legend class="title is-5 mb-1">
{% blocktrans with name=author.name %}Is "{{ name }}" one of these?{% endblocktrans %}
{% blocktrans with name=author.name %}Is "{{ name }}" one of these authors?{% endblocktrans %}
</legend>
{% with forloop.counter0 as counter %}
{% for match in author.isni_matches %}
<label class="label mb-2">
<input type="radio" name="author_match-{{ counter }}" value="{{ match.id }}" required>
{{ match.name }}
<span class="help">
<a href="{{ match.uri }}" target="_blank"><em>{{ match.description }}</em></a>
</span>
{% if author.isni_matches %}
{% for isni_match in author.isni_matches %}
<label class="label mt-2">
<input type="radio" name="author_match-{{ counter }}" value="{{ isni_match.name }}" required>
{{ isni_match.name }}
</label>
<p class="help ml-5 mb-2">
<a href="{{ match.uri }}" target="_blank">{{ isni_match.bio }}</a>
</p>
<input type="text" name="isni_match-{{ counter }}" value="{{ isni_match.isni }}" hidden>
{% endfor %}
{% endwith %}
</fieldset>
{% endif %}
<fieldset>
<legend class="title is-5 mb-1">
{% blocktrans with name=author.name %}Is "{{ name }}" an existing author?{% endblocktrans %}
</legend>
{% with forloop.counter0 as counter %}
{% endif %}
{% for match in author.matches %}
<label class="label mb-2">
<label class="label">
<input type="radio" name="author_match-{{ counter }}" value="{{ match.id }}" required>
{{ match.name }}
</label>
<p class="help">
<p class="help ml-5 mb-2">
<a href="{{ match.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">
<label class="label mt-2">
<input type="radio" name="author_match-{{ counter }}" value="{{ author.name }}" required> {% trans "This is a new author" %}
</label>
{% endwith %}