Merge pull request #1477 from bookwyrm-social/add-edit-book

Updates for adding and editing books
This commit is contained in:
Mouse Reeve
2021-10-01 10:36:09 -07:00
committed by GitHub
50 changed files with 777 additions and 784 deletions

View File

@ -12,7 +12,7 @@ draft: an existing Status object that is providing default values for input fiel
name="content"
class="textarea save-draft"
data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}"
placeholder="{{ placeholder }}"
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% endif %}"
{% if not optional and type != "quotation" and type != "review" %}required{% endif %}

View File

@ -19,7 +19,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
name="{{ type }}"
action="/post/{{ type }}"
method="post"
id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
id="form_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
>
{% endblock %}
@ -36,7 +36,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
{# fields that go between the content warnings and the content field (ie, quote) #}
{% block pre_content_additions %}{% endblock %}
<label class="label" for="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}">
<label class="label" for="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}">
{% block content_label %}
{% trans "Comment:" %}
{% endblock %}

View File

@ -1,6 +1,10 @@
{% load i18n %}
<div class="content">
<p>{% blocktrans %}Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.{% endblocktrans %}</p>
<p>
{% blocktrans trimmed %}
Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.
{% endblocktrans %}
</p>
<form method="post" name="goal" action="{% url 'user-goal' request.user.localname year %}">
{% csrf_token %}
@ -20,7 +24,7 @@
<div class="column">
<label class="label" for="privacy_{{ goal.id }}">{% trans "Goal privacy:" %}</label>
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy uuid=goal.id %}
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy privacy_uuid=goal.id %}
</div>
</div>

View File

@ -1,7 +1,7 @@
{% load i18n %}
{% load utilities %}
<div class="select {{ class }}">
{% firstof uuid 0|uuid as uuid %}
{% firstof privacy_uuid 0|uuid as uuid %}
{% if not no_label %}
<label class="is-sr-only" for="privacy_{{ uuid }}">{% trans "Post privacy" %}</label>
{% endif %}

View File

@ -5,7 +5,7 @@
type="number"
name="progress"
class="input"
id="id_progress_{{ readthrough.id }}"
id="id_progress_{{ readthrough.id }}{{ controls_uid }}"
value="{{ readthrough.progress }}"
{% if progress_required %}required{% endif %}
>

View File

@ -35,3 +35,7 @@ Finish "<em>{{ book_title }}</em>"
</div>
</div>
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="finish_modal" %}
{% endblock %}

View File

@ -15,3 +15,5 @@
<input type="hidden" name="mention_books" value="{{ book.id }}">
<input type="hidden" name="book" value="{{ book.id }}">
{% endblock %}
{% block form_close %}{% endblock %}

View File

@ -23,10 +23,11 @@
<div id="reading_content_{{ local_uuid }}_{{ uuid }}">
<hr aria-hidden="true">
<fieldset id="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}">
{% comparison_bool controls_text "progress_update" True as optional %}
{% include "snippets/reading_modals/form.html" with optional=optional %}
{% block form %}{% endblock %}
</fieldset>
</div>
{% endwith %}
{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View File

@ -12,6 +12,10 @@
{% endblock %}
{% block reading-dates %}
<label for="id_progress_{{ readthrough.id }}" class="label">{% trans "Progress:" %}</label>
<label for="id_progress_{{ readthrough.id }}{{ controls_uid }}" class="label">{% trans "Progress:" %}</label>
{% include "snippets/progress_field.html" with progress_required=True %}
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=False type="update_modal" %}
{% endblock %}

View File

@ -22,3 +22,7 @@ Start "<em>{{ book_title }}</em>"
<input type="date" name="start_date" class="input" id="start_id_start_date_{{ uuid }}" value="{% now "Y-m-d" %}">
</div>
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="start_modal" %}
{% endblock %}

View File

@ -13,3 +13,7 @@ Want to Read "<em>{{ book_title }}</em>"
<input type="hidden" name="reading_status" value="to-read">
{% csrf_token %}
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="want_modal" %}
{% endblock %}

View File

@ -10,7 +10,7 @@
</div>
{# Only show progress for editing existing readthroughs #}
{% if readthrough.id and not readthrough.finish_date %}
<label class="label" for="id_progress_{{ readthrough.id }}">
<label class="label" for="id_progress_{{ readthrough.id }}{{ controls_uid }}">
{% trans "Progress" %}
</label>
{% include "snippets/progress_field.html" %}

View File

@ -11,7 +11,7 @@
{% if status.user == request.user %}
{# things you can do to your own statuses #}
<li role="menuitem" class="dropdown-item p-0">
<form name="delete-{{ status.id }}" action="/delete-status/{{ status.id }}" method="post">
<form name="delete-{{ status.id|uuid }}" action="/delete-status/{{ status.id }}" method="post">
{% csrf_token %}
<button class="button is-radiusless is-danger is-light is-fullwidth is-small" type="submit">
{% trans "Delete status" %}

View File

@ -1,5 +1,6 @@
{% load utilities %}
{% if fallback_url %}
<form name="fallback-form-{{ controls_uuid}}" method="GET" action="{{ fallback_url }}">
<form name="fallback_form_{{ 0|uuid }}" method="GET" action="{{ fallback_url }}">
{% endif %}
<button
{% if not fallback_url %}