mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-29 11:30:39 +00:00
Adds content warning field in status forms
This commit is contained in:
parent
0d42b9cf8f
commit
172c36b641
5 changed files with 36 additions and 12 deletions
|
@ -54,7 +54,7 @@ class Comment(Note):
|
|||
class Review(Comment):
|
||||
''' a full book review '''
|
||||
name: str
|
||||
rating: int
|
||||
rating: int = None
|
||||
type: str = 'Review'
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -26,6 +26,16 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<div class="control">
|
||||
<label class="button is-small" role="button" tabindex="0" for="include-spoilers-{{ book.id }}-{{ type }}">Add spoilers/content warning</label>
|
||||
<input type="checkbox" class="toggle-control" id="include-spoilers-{{ book.id }}-{{ type }}">
|
||||
<div class="toggle-content hidden">
|
||||
<label class="is-sr-only" for="id_content_warning_{{ book.id }}_{{ type }}">Spoilers/content warning:</label>
|
||||
<input type="text" name="content_warning" maxlength="255" class="input" id="id_content_warning_{{ book.id }}_{{ type }}" placeholder="Spoilers ahead!">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if type == 'quote' %}
|
||||
<textarea name="quote" class="textarea" id="id_quote_{{ book.id }}_{{ type }}" placeholder="{{ placeholder }}" required></textarea>
|
||||
{% else %}
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
<input type="hidden" name="reply_parent" value="{{ activity.id }}">
|
||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||
<div class="column">
|
||||
<div class="control">
|
||||
<label class="button is-small" role="button" tabindex="0" for="include-spoilers-{{ book.id }}-{{ type }}">Add spoilers/content warning</label>
|
||||
<input type="checkbox" class="toggle-control" id="include-spoilers-{{ book.id }}-{{ type }}">
|
||||
<div class="toggle-content hidden">
|
||||
<label class="is-sr-only" for="id_content_warning_{{ book.id }}_{{ type }}">Spoilers/content warning:</label>
|
||||
<input type="text" name="content_warning" maxlength="255" class="input" id="id_content_warning_{{ book.id }}_{{ type }}" placeholder="Spoilers ahead!">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<textarea class="textarea" name="content" placeholder="Leave a comment..." id="id_content_{{ activity.id }}-{{ uuid }}" required="true"></textarea>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
{% load bookwyrm_tags %}
|
||||
<div class="block">
|
||||
{% if status.status_type == 'Review' %}
|
||||
<div>
|
||||
<h3 class="title is-5 has-subtitle">
|
||||
{% if status.name %}{{ status.name }}<br>{% endif %}
|
||||
</h3>
|
||||
<p class="subtitle">{% include 'snippets/stars.html' with rating=status.rating %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if status.content_warning %}
|
||||
<div class="toggle-content">
|
||||
<p>{{ status.content_warning }}</p>
|
||||
|
@ -16,13 +25,6 @@
|
|||
<label class="button is-small" for="hide-status-cw-{{ status.id }}" tabindex="0" role="button">Show Less</label>
|
||||
{% endif %}
|
||||
|
||||
{% if status.status_type == 'Review' %}
|
||||
<h3>
|
||||
{% if status.name %}{{ status.name }}<br>{% endif %}
|
||||
{% include 'snippets/stars.html' with rating=status.rating %}
|
||||
</h3>
|
||||
{% endif %}
|
||||
|
||||
{% if status.quote %}
|
||||
<div class="quote block">
|
||||
<blockquote>{{ status.quote }}</blockquote>
|
||||
|
|
Loading…
Reference in a new issue