Merge pull request #1423 from bookwyrm-social/modal-cws

Fixes content warning fields in modals
This commit is contained in:
Mouse Reeve 2021-09-18 14:44:00 -07:00 committed by GitHub
commit 7bb9bea0c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -13,7 +13,7 @@ VERSION = "0.0.1"
PAGE_LENGTH = env("PAGE_LENGTH", 15) PAGE_LENGTH = env("PAGE_LENGTH", 15)
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English") DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
JS_CACHE = "e5832a26" JS_CACHE = "7f2343cf"
# email # email
EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend") EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")

View file

@ -1,11 +1,11 @@
{% load i18n %} {% load i18n %}
<div <div
class="field{% if not parent_status.content_warning and not draft.content_warning %} is-hidden{% endif %}" class="field{% if not parent_status.content_warning and not draft.content_warning %} is-hidden{% endif %}"
id="spoilers_{{ uuid }}" id="spoilers_{{ uuid }}{{ local_uuid }}"
> >
<label <label
class="label" class="label"
for="id_content_warning_{{ uuid }}" for="id_content_warning_{{ uuid }}{{ local_uuid }}"
> >
{% trans "Content warning:" %} {% trans "Content warning:" %}
</label> </label>
@ -14,7 +14,7 @@
name="content_warning" name="content_warning"
maxlength="255" maxlength="255"
class="input" class="input"
id="id_content_warning_{{ uuid }}" id="id_content_warning_{{ uuid }}{{ local_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 }}" data-cache-draft="id_content_warning_{{ book.id }}_{{ type }}"

View file

@ -5,12 +5,13 @@
type="checkbox" type="checkbox"
class="is-hidden" class="is-hidden"
name="sensitive" name="sensitive"
id="id_show_spoilers_{{ uuid }}" id="id_show_spoilers_{{ uuid }}{{ local_uuid }}"
{% if draft.content_warning or status.content_warning %}checked{% endif %} {% if draft.content_warning or status.content_warning %}checked{% endif %}
aria-hidden="true" aria-hidden="true"
data-cache-draft="id_sensitive_{{ book.id }}_{{ type }}{{ reply_parent.id }}" 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 %} {% firstof local_uuid '' as local_uuid %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid|add:local_uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %}
</div> </div>