From 172c36b6416c05997e18ce0b75a6ed143bf34ae2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 16 Dec 2020 20:10:50 -0800 Subject: [PATCH] Adds content warning field in status forms --- bookwyrm/activitypub/note.py | 2 +- bookwyrm/forms.py | 12 ++++++++---- .../templates/snippets/create_status_form.html | 10 ++++++++++ bookwyrm/templates/snippets/reply_form.html | 8 ++++++++ bookwyrm/templates/snippets/status_content.html | 16 +++++++++------- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/bookwyrm/activitypub/note.py b/bookwyrm/activitypub/note.py index 263ddb2a6..b478c96dd 100644 --- a/bookwyrm/activitypub/note.py +++ b/bookwyrm/activitypub/note.py @@ -54,7 +54,7 @@ class Comment(Note): class Review(Comment): ''' a full book review ''' name: str - rating: int + rating: int = None type: str = 'Review' diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index a2c3e24bb..454836bb7 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -60,25 +60,29 @@ class RatingForm(CustomForm): class ReviewForm(CustomForm): class Meta: model = models.Review - fields = ['user', 'book', 'name', 'content', 'rating', 'privacy'] + fields = [ + 'user', 'book', 'name', 'content', 'content_warning', 'rating', + 'privacy'] class CommentForm(CustomForm): class Meta: model = models.Comment - fields = ['user', 'book', 'content', 'privacy'] + fields = ['user', 'book', 'content', 'content_warning', 'privacy'] class QuotationForm(CustomForm): class Meta: model = models.Quotation - fields = ['user', 'book', 'quote', 'content', 'privacy'] + fields = [ + 'user', 'book', 'quote', 'content', 'content_warning', 'privacy'] class ReplyForm(CustomForm): class Meta: model = models.Status - fields = ['user', 'content', 'reply_parent', 'privacy'] + fields = [ + 'user', 'content', 'content_warning', 'reply_parent', 'privacy'] class EditUserForm(CustomForm): diff --git a/bookwyrm/templates/snippets/create_status_form.html b/bookwyrm/templates/snippets/create_status_form.html index d6aa3fb3c..70062db4d 100644 --- a/bookwyrm/templates/snippets/create_status_form.html +++ b/bookwyrm/templates/snippets/create_status_form.html @@ -26,6 +26,16 @@ {% endif %} + +
+ + + +
+ {% if type == 'quote' %} {% else %} diff --git a/bookwyrm/templates/snippets/reply_form.html b/bookwyrm/templates/snippets/reply_form.html index d0a0f6b9d..65aa3e46a 100644 --- a/bookwyrm/templates/snippets/reply_form.html +++ b/bookwyrm/templates/snippets/reply_form.html @@ -6,6 +6,14 @@
+
+ + + +
diff --git a/bookwyrm/templates/snippets/status_content.html b/bookwyrm/templates/snippets/status_content.html index ff87b3b6a..6e4a6b983 100644 --- a/bookwyrm/templates/snippets/status_content.html +++ b/bookwyrm/templates/snippets/status_content.html @@ -1,5 +1,14 @@ {% load bookwyrm_tags %}
+ {% if status.status_type == 'Review' %} +
+

+ {% if status.name %}{{ status.name }}
{% endif %} +

+

{% include 'snippets/stars.html' with rating=status.rating %}

+
+ {% endif %} + {% if status.content_warning %}

{{ status.content_warning }}

@@ -16,13 +25,6 @@ {% endif %} - {% if status.status_type == 'Review' %} -

- {% if status.name %}{{ status.name }}
{% endif %} - {% include 'snippets/stars.html' with rating=status.rating %} -

- {% endif %} - {% if status.quote %}
{{ status.quote }}