Merge branch 'main' into bookwyrm-groups

There are database migrations in main ahead of this branch so they need to be merged in to the branch before we can merge back into main.
This commit is contained in:
Hugh Rundle
2021-10-17 06:22:04 +11:00
90 changed files with 2446 additions and 92814 deletions

View File

@ -15,6 +15,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
{% trans "Some thoughts on the book" as placeholder %}
{% block post_content_additions %}
{% if not draft.reading_status %}
{# Supplemental fields #}
<div>
{% active_shelf book as active_shelf %}
@ -35,7 +36,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
size="3"
value="{% firstof draft.progress readthrough.progress '' %}"
id="progress_{{ uuid }}"
data-cache-draft="id_progress_comment_{{ book.id }}"
{% if not draft %}data-cache-draft="id_progress_comment_{{ book.id }}"{% endif %}
>
</div>
<div class="control">
@ -43,7 +44,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
<select
name="progress_mode"
aria-label="Progress mode"
data-cache-draft="id_progress_mode_comment_{{ book.id }}"
{% if not draft %}data-cache-draft="id_progress_mode_comment_{{ book.id }}"{% endif %}
>
<option
value="PG"
@ -68,6 +69,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
{% endwith %}
{% endif %}
</div>
{% endif %}
{% endblock %}
{% endwith %}

View File

@ -11,10 +11,10 @@ draft: an existing Status object that is providing default values for input fiel
<textarea
name="content"
class="textarea save-draft"
data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
{% if not draft %}data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"{% endif %}
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 %}
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{{ draft.content|default:'' }}</textarea>
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{% firstof draft.raw_content draft.content '' %}</textarea>

View File

@ -17,6 +17,6 @@
id="id_content_warning_{{ uuid }}{{ local_uuid }}"
placeholder="{% trans 'Spoilers ahead!' %}"
value="{% firstof draft.content_warning reply_parent.content_warning '' %}"
data-cache-draft="id_content_warning_{{ book.id }}_{{ type }}"
{% if not draft %}data-cache-draft="id_content_warning_{{ book.id }}_{{ type }}"{% endif %}
>
</div>

View File

@ -8,7 +8,7 @@
id="id_show_spoilers_{{ uuid }}{{ local_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 }}"
{% if not draft %}data-cache-draft="id_sensitive_{{ book.id }}_{{ type }}{{ reply_parent.id }}"{% endif %}
>
{% trans "Include spoiler alert" as button_text %}
{% firstof draft.content_warning status.content_warning as pressed %}

View File

@ -17,7 +17,11 @@ reply_parent: the Status object this post will be in reply to, if applicable
<form
class="is-flex-grow-1{% if not no_script %} submit-status{% endif %}"
name="{{ type }}"
action="/post/{{ type }}"
{% if draft %}
action="{% url 'create-status' type draft.id %}"
{% else %}
action="{% url 'create-status' type %}"
{% endif %}
method="post"
id="form_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
>
@ -29,6 +33,9 @@ reply_parent: the Status object this post will be in reply to, if applicable
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="user" value="{{ request.user.id }}">
<input type="hidden" name="reply_parent" value="{% firstof draft.reply_parent.id reply_parent.id %}">
{% if draft %}
<input type="hidden" name="reading_status" value="{{ draft.reading_status|default:'' }}">
{% endif %}
{% endblock %}
{% include "snippets/create_status/content_warning_field.html" %}

View File

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

View File

@ -24,7 +24,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
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 }}"
{% if not draft %}data-cache-draft="id_name_{{ book.id }}_{{ type }}"{% endif %}
>
</div>
</div>

View File

@ -1,7 +1,19 @@
{% spaceless %}
{% load humanize %}
{% load i18n %}
{% if total_pages %}
{% blocktrans with page=page|intcomma total_pages=total_pages|intcomma %}page {{ page }} of {{ total_pages }}{% endblocktrans %}
{% blocktrans trimmed with page=page|intcomma total_pages=total_pages|intcomma %}
page {{ page }} of {{ total_pages }}
{% endblocktrans %}
{% else %}
{% blocktrans with page=page|intcomma %}page {{ page }}{% endblocktrans %}
{% blocktrans trimmed with page=page|intcomma %}
page {{ page }}
{% endblocktrans %}
{% endif %}
{% endspaceless %}

View File

@ -3,7 +3,7 @@
{% if request.user.is_authenticated %}
<span class="is-sr-only">{% trans "Leave a rating" %}</span>
<div class="block">
<form class="hidden-form" name="rate" action="/post/rating" method="POST">
<form class="hidden-form" name="rate" action="{% url 'create-status' 'rating' %}" method="POST">
{% csrf_token %}
<input type="hidden" name="user" value="{{ request.user.id }}">
<input type="hidden" name="book" value="{{ book.id }}">

View File

@ -31,18 +31,38 @@
{% include "snippets/status/header_content.html" %}
</h3>
<p class="is-size-7 is-flex is-align-items-center">
<a href="{{ status.remote_id }}{% if status.user.local %}#anchor-{{ status.id }}{% endif %}">{{ status.published_date|published_date }}</a>
{% if status.progress %}
<span class="ml-1">
{% if status.progress_mode == 'PG' %}
({% include 'snippets/page_text.html' with page=status.progress total_pages=status.book.pages %})
{% else %}
({{ status.progress }}%)
{% endif %}
</span>
{% endif %}
{% include 'snippets/privacy-icons.html' with item=status %}
</p>
<div class="breadcrumb has-dot-separator is-small">
<ul class="is-flex is-align-items-center">
<li>
<a href="{{ status.remote_id }}{% if status.user.local %}#anchor-{{ status.id }}{% endif %}">
{{ status.published_date|published_date }}
</a>
</li>
{% if status.edited_date %}
<li>
<span>
{% blocktrans with date=status.edited_date|published_date %}edited {{ date }}{% endblocktrans %}
</span>
</li>
{% endif %}
{% if status.progress %}
<li class="ml-1">
<span>
{% if status.progress_mode == 'PG' %}
{% include 'snippets/page_text.html' with page=status.progress total_pages=status.book.pages %}
{% else %}
{{ status.progress }}%
{% endif %}
</span>
</li>
{% endif %}
<li>
{% include 'snippets/privacy-icons.html' with item=status %}
</li>
</ul>
</div>
</div>
</div>

View File

@ -67,7 +67,7 @@
{% endblock %}
{% block card-bonus %}
{% if request.user.is_authenticated and not moderation_mode %}
{% if request.user.is_authenticated and not moderation_mode and not no_interact %}
{% with status.id|uuid as uuid %}
<section class="reply-panel is-hidden" id="show_comment_{{ status.id }}">
<div class="card-footer">

View File

@ -20,12 +20,9 @@
</li>
{% if status.status_type != 'GeneratedNote' and status.status_type != 'Rating' %}
<li role="menuitem" class="dropdown-item p-0">
<form class="" name="delete-{{ status.id }}" action="{% url 'redraft' status.id %}" method="post">
{% csrf_token %}
<button class="button is-radiusless is-danger is-light is-fullwidth is-small" type="submit">
{% trans "Delete & re-draft" %}
</button>
</form>
<a href="{% url 'edit-status' status.id %}" class="button is-radiusless is-fullwidth is-small" type="submit">
{% trans "Edit" %}
</a>
</li>
{% endif %}
{% else %}