Ties draft functionality to more status fields

This commit is contained in:
Mouse Reeve 2021-09-08 19:30:24 -07:00
parent 59ec45496c
commit 71b2f91a73
6 changed files with 37 additions and 6 deletions

View file

@ -35,11 +35,16 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
size="3" size="3"
value="{% firstof draft.progress readthrough.progress '' %}" value="{% firstof draft.progress readthrough.progress '' %}"
id="progress_{{ uuid }}" id="progress_{{ uuid }}"
data-cache-draft="id_progress_comment_{{ book.id }}"
> >
</div> </div>
<div class="control"> <div class="control">
<div class="select"> <div class="select">
<select name="progress_mode" aria-label="Progress mode"> <select
name="progress_mode"
aria-label="Progress mode"
data-cache-draft="id_progress_mode_comment_{{ book.id }}"
>
<option <option
value="PG" value="PG"
{% if draft.progress_mode == 'PG' or readthrough.progress_mode == 'PG' %}selected{% endif %} {% if draft.progress_mode == 'PG' or readthrough.progress_mode == 'PG' %}selected{% endif %}

View file

@ -8,5 +8,7 @@
class="input" class="input"
id="id_content_warning_{{ uuid }}" id="id_content_warning_{{ uuid }}"
placeholder="{% trans 'Spoilers ahead!' %}" placeholder="{% trans 'Spoilers ahead!' %}"
value="{% firstof draft.content_warning parent_status.content_warning '' %}"> value="{% firstof draft.content_warning parent_status.content_warning '' %}"
data-cache-draft="id_content_warning_{{ book.id }}_{{ type }}"
>
</div> </div>

View file

@ -1,7 +1,15 @@
{% load i18n %} {% load i18n %}
<div class="control"> <div class="control">
<input type="checkbox" class="is-hidden" name="sensitive" id="id_show_spoilers_{{ uuid }}" {% if draft.content_warning or status.content_warning %}checked{% endif %} aria-hidden="true"> <input
type="checkbox"
class="is-hidden"
name="sensitive"
id="id_show_spoilers_{{ uuid }}"
{% if draft.content_warning or status.content_warning %}checked{% endif %}
aria-hidden="true"
data-cache-draft="id_sensitive_{{ book.id }}_{{ type }}{{ reply_parent.id }}"
>
{% trans "Include spoiler alert" as button_text %} {% trans "Include spoiler alert" as button_text %}
{% firstof draft.content_warning status.content_warning as pressed %} {% firstof draft.content_warning status.content_warning as pressed %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %} {% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %}

View file

@ -14,7 +14,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
{% block form_open %} {% block form_open %}
{# default form tag syntax, can be overriddden #} {# default form tag syntax, can be overriddden #}
<form class="is-flex-grow-1" name="{{ type }}" action="/post/{{ type }}" method="post" id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}"> <form class="is-flex-grow-1 submit-status" name="{{ type }}" action="/post/{{ type }}" method="post" id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}">
{% endblock %} {% endblock %}
{% csrf_token %} {% csrf_token %}

View file

@ -24,6 +24,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
id="id_quote_{{ book.id }}_{{ type }}" id="id_quote_{{ book.id }}_{{ type }}"
placeholder="{% blocktrans with book_title=book.title %}An excerpt from '{{ book_title }}'{% endblocktrans %}" placeholder="{% blocktrans with book_title=book.title %}An excerpt from '{{ book_title }}'{% endblocktrans %}"
required required
data-cache-draft="id_quote_{{ book.id }}_{{ type }}"
>{{ draft.quote|default:'' }}</textarea> >{{ draft.quote|default:'' }}</textarea>
</div> </div>
</div> </div>
@ -32,7 +33,11 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
<div class="field has-addons mb-0"> <div class="field has-addons mb-0">
<div class="control"> <div class="control">
<div class="select"> <div class="select">
<select name="position_mode" aria-label="Position mode"> <select
name="position_mode"
aria-label="Position mode"
data-cache-draft="id_position_mode_{{ book.id }}_{{ type }}"
>
<option <option
value="PG" value="PG"
{% if draft.position_mode == 'PG' or not draft %}selected{% endif %} {% if draft.position_mode == 'PG' or not draft %}selected{% endif %}
@ -58,6 +63,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
size="3" size="3"
value="{% firstof draft.position '' %}" value="{% firstof draft.position '' %}"
id="position_{{ uuid }}" id="position_{{ uuid }}"
data-cache-draft="id_position_{{ book.id }}_{{ type }}"
> >
</div> </div>
</div> </div>

View file

@ -15,7 +15,17 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
<div class="field"> <div class="field">
<label class="label" for="id_name_{{ book.id }}">{% trans "Title:" %}</label> <label class="label" for="id_name_{{ book.id }}">{% trans "Title:" %}</label>
<div class="control"> <div class="control">
<input type="text" name="name" maxlength="255" class="input" required="" id="id_name_{{ book.id }}" placeholder="{% blocktrans with book_title=book.title %}Your review of '{{ book_title }}'{% endblocktrans %}" value="{% firstof draft.name ''%}"> <input
type="text"
name="name"
maxlength="255"
class="input"
required=""
id="id_name_{{ book.id }}"
placeholder="{% blocktrans with book_title=book.title %}Your review of '{{ book_title }}'{% endblocktrans %}"
value="{% firstof draft.name ''%}"
data-cache-draft="id_name_{{ book.id }}_{{ type }}"
>
</div> </div>
</div> </div>