Merge branch 'main' into groups-merge-test

Big merge of a couple of weeks' work from the main project back into this branch. :ohno:
This commit is contained in:
Hugh Rundle
2021-10-03 10:49:38 +11:00
231 changed files with 8983 additions and 7361 deletions

View File

@ -12,7 +12,7 @@ draft: an existing Status object that is providing default values for input fiel
name="content"
class="textarea save-draft"
data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
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 %}

View File

@ -19,7 +19,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
name="{{ type }}"
action="/post/{{ type }}"
method="post"
id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
id="form_{{ type }}_{{ book.id }}{{ reply_parent.id }}"
>
{% endblock %}
@ -36,7 +36,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
{# fields that go between the content warnings and the content field (ie, quote) #}
{% block pre_content_additions %}{% endblock %}
<label class="label" for="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}">
<label class="label" for="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}">
{% block content_label %}
{% trans "Comment:" %}
{% endblock %}

View File

@ -1,25 +0,0 @@
{% extends 'components/card.html' %}
{% load i18n %}
{% block card-header %}
<h3 class="card-header-title has-background-primary has-text-white">
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span> {% blocktrans %}{{ year }} Reading Goal{% endblocktrans %}
</h3>
{% endblock %}
{% block card-content %}
<div class="content">
<p>{% blocktrans %}Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.{% endblocktrans %}</p>
{% include 'snippets/goal_form.html' %}
</div>
{% endblock %}
{% block card-footer %}
<form class="card-footer-item is-flex-direction-column" method="post" action="{% url 'hide-goal' %}">
{% csrf_token %}
<button type="submit" class="button is-danger is-light is-block set-display" >{% trans "Dismiss message" %}</button>
<p class="help">{% blocktrans with path=request.user.local_path %}You can set or change your reading goal any time from your <a href="{{ path }}">profile page</a>{% endblocktrans %}</p>
</form>
{% endblock %}

View File

@ -1,36 +1,40 @@
{% load i18n %}
<form method="post" name="goal" action="{% url 'user-goal' request.user.localname year %}">
{% csrf_token %}
<input type="hidden" name="year" value="{% if goal %}{{ goal.year }}{% else %}{{ year }}{% endif %}">
<input type="hidden" name="user" value="{{ request.user.id }}">
<div class="content">
<p>
{% blocktrans trimmed %}
Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.
{% endblocktrans %}
</p>
<div class="columns">
<div class="column">
<label class="label" for="id_goal">{% trans "Reading goal:" %}</label>
<div class="field has-addons">
<div class="control">
<input type="number" class="input" name="goal" min="1" id="id_goal" value="{% if goal %}{{ goal.goal }}{% else %}12{% endif %}">
<form method="post" name="goal" action="{% url 'user-goal' request.user.localname year %}">
{% csrf_token %}
<input type="hidden" name="year" value="{% if goal %}{{ goal.year }}{% else %}{{ year }}{% endif %}">
<input type="hidden" name="user" value="{{ request.user.id }}">
<div class="columns">
<div class="column">
<label class="label" for="id_goal">{% trans "Reading goal:" %}</label>
<div class="field has-addons">
<div class="control">
<input type="number" class="input" name="goal" min="1" id="id_goal" value="{% if goal %}{{ goal.goal }}{% else %}12{% endif %}">
</div>
<p class="button is-static" aria-hidden="true">{% trans "books" %}</p>
</div>
<p class="button is-static" aria-hidden="true">{% trans "books" %}</p>
</div>
<div class="column">
<label class="label" for="privacy_{{ goal.id }}">{% trans "Goal privacy:" %}</label>
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy privacy_uuid=goal.id %}
</div>
</div>
<div class="column">
<label class="label"><p class="mb-2">{% trans "Goal privacy:" %}</p>
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy %}
</label>
</div>
</div>
<label for="post_status" class="label">
<input type="checkbox" name="post-status" id="post_status" class="checkbox" checked>
{% trans "Post to feed" %}
</label>
<label for="post_status" class="label">
<input type="checkbox" name="post-status" id="post_status" class="checkbox" checked>
{% trans "Post to feed" %}
</label>
<p>
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
{% if goal %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="show_edit_goal" %}
{% endif %}
</p>
</form>
<div class="field">
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
</div>
</form>
</div>

View File

@ -1,7 +1,7 @@
{% load i18n %}
{% load utilities %}
<div class="select {{ class }}">
{% with 0|uuid as uuid %}
{% firstof privacy_uuid 0|uuid as uuid %}
{% if not no_label %}
<label class="is-sr-only" for="privacy_{{ uuid }}">{% trans "Post privacy" %}</label>
{% endif %}
@ -20,6 +20,5 @@
{% trans "Private" %}
</option>
</select>
{% endwith %}
</div>

View File

@ -0,0 +1,27 @@
{% load i18n %}
<div class="field has-addons">
<div class="control">
<input
type="number"
name="progress"
class="input"
id="id_progress_{{ readthrough.id }}{{ controls_uid }}"
value="{{ readthrough.progress }}"
{% if progress_required %}required{% endif %}
>
</div>
<div class="control select">
<select name="progress_mode" aria-label="Progress mode">
<option
value="PG"
{% if readthrough.progress_mode == 'PG' %}selected{% endif %}>
{% trans "pages" %}
</option>
<option
value="PCT"
{% if readthrough.progress_mode == 'PCT' %}selected{% endif %}>
{% trans "percent" %}
</option>
</select>
</div>
</div>

View File

@ -11,6 +11,7 @@ Finish "<em>{{ book_title }}</em>"
{% block modal-form-open %}
<form name="finish-reading" action="{% url 'reading-status' 'finish' book.id %}" method="post" class="submit-status">
{% csrf_token %}
<input type="hidden" name="id" value="{{ readthrough.id }}">
<input type="hidden" name="reading_status" value="read">
{% endblock %}
@ -34,3 +35,7 @@ Finish "<em>{{ book_title }}</em>"
</div>
</div>
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="finish_modal" %}
{% endblock %}

View File

@ -5,12 +5,15 @@
{% block content_label %}
{% trans "Comment:" %}
{% if optional %}
<span class="help mt-0 has-text-weight-normal">{% trans "(Optional)" %}</span>
{% endif %}
{% endblock %}
{% block initial_fields %}
<input type="hidden" name="user" value="{{ request.user.id }}">
<input type="hidden" name="mention_books" value="{{ book.id }}">
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="id" value="{{ readthrough.id }}">
{% endblock %}
{% block form_close %}{% endblock %}

View File

@ -13,16 +13,21 @@
{% trans "Post to feed" %}
</label>
<div class="is-hidden" id="hide_reading_content_{{ local_uuid }}_{{ uuid }}">
<button class="button is-link" type="submit">{% trans "Save" %}</button>
<button class="button is-link" type="submit">
<span class="icon icon-spinner" aria-hidden="true"></span>
<span>{% trans "Save" %}</span>
</button>
</div>
</div>
<div id="reading_content_{{ local_uuid }}_{{ uuid }}">
<hr aria-hidden="true">
<fieldset id="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}">
{% include "snippets/reading_modals/form.html" with optional=True %}
{% block form %}{% endblock %}
</fieldset>
</div>
{% endwith %}
{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends 'components/modal.html' %}
{% extends 'snippets/reading_modals/layout.html' %}
{% load i18n %}
{% block modal-title %}
@ -6,42 +6,16 @@
{% endblock %}
{% block modal-form-open %}
<form action="{% url 'edit-readthrough' %}" method="POST" class="submit-status">
{% endblock %}
{% block modal-body %}
<form name="reading-progress" action="{% url 'reading-status-update' book.id %}" method="POST" class="submit-status">
{% csrf_token %}
<input type="hidden" name="id" value="{{ readthrough.id }}"/>
<div class="field">
<label class="label is-align-self-center mb-0 pr-2" for="progress">{% trans "Progress:" %}</label>
<div class="field has-addons mb-0">
<div class="control">
<input
aria-label="{% if readthrough.progress_mode == 'PG' %}Current page{% else %}Percent read{% endif %}"
class="input"
type="number"
min="0"
name="progress"
size="3"
value="{{ readthrough.progress|default:'' }}"
>
</div>
<div class="control select">
<select name="progress_mode" aria-label="Progress mode">
<option value="PG" {% if readthrough.progress_mode == 'PG' %}selected{% endif %}>{% trans "pages" %}</option>
<option value="PCT" {% if readthrough.progress_mode == 'PCT' %}selected{% endif %}>{% trans "percent" %}</option>
</select>
</div>
</div>
{% if readthrough.progress_mode == 'PG' and book.pages %}
<p class="help">{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}</p>
{% endif %}
</div>
<input type="hidden" name="id" value="{{ readthrough.id }}">
{% endblock %}
{% block modal-footer %}
<button class="button is-success" type="submit">{% trans "Save" %}</button>
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text %}
{% block reading-dates %}
<label for="id_progress_{{ readthrough.id }}{{ controls_uid }}" class="label">{% trans "Progress:" %}</label>
{% include "snippets/progress_field.html" with progress_required=True %}
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=False type="update_modal" %}
{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View File

@ -22,3 +22,7 @@ Start "<em>{{ book_title }}</em>"
<input type="date" name="start_date" class="input" id="start_id_start_date_{{ uuid }}" value="{% now "Y-m-d" %}">
</div>
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="start_modal" %}
{% endblock %}

View File

@ -13,3 +13,7 @@ Want to Read "<em>{{ book_title }}</em>"
<input type="hidden" name="reading_status" value="to-read">
{% csrf_token %}
{% endblock %}
{% block form %}
{% include "snippets/reading_modals/form.html" with optional=True type="want_modal" %}
{% endblock %}

View File

@ -10,20 +10,10 @@
</div>
{# Only show progress for editing existing readthroughs #}
{% if readthrough.id and not readthrough.finish_date %}
<label class="label" for="id_progress_{{ readthrough.id }}">
<label class="label" for="id_progress_{{ readthrough.id }}{{ controls_uid }}">
{% trans "Progress" %}
</label>
<div class="field has-addons">
<div class="control">
<input type="number" name="progress" class="input" id="id_progress_{{ readthrough.id }}" value="{{ readthrough.progress }}">
</div>
<div class="control select">
<select name="progress_mode" aria-label="Progress mode">
<option value="PG" {% if readthrough.progress_mode == 'PG' %}selected{% endif %}>{% trans "pages" %}</option>
<option value="PCT" {% if readthrough.progress_mode == 'PCT' %}selected{% endif %}>{% trans "percent" %}</option>
</select>
</div>
</div>
{% include "snippets/progress_field.html" %}
{% endif %}
<div class="field">
<label class="label" for="id_finish_date_{{ readthrough.id }}">

View File

@ -6,6 +6,6 @@
{% trans "Report" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class="is-danger is-light is-small is-fullwidth" text=button_text controls_text="report" controls_uid=report_uuid focus="modal_title_report" disabled=is_current %}
{% include 'moderation/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %}
{% include 'snippets/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %}
{% endwith %}

View File

@ -0,0 +1,39 @@
{% extends 'components/modal.html' %}
{% load i18n %}
{% load humanize %}
{% block modal-title %}
{% blocktrans with username=user.username %}Report @{{ username }}{% endblocktrans %}
{% endblock %}
{% block modal-form-open %}
<form name="report" method="post" action="{% url 'report' %}">
{% endblock %}
{% block modal-body %}
{% csrf_token %}
<input type="hidden" name="reporter" value="{{ reporter.id }}">
<input type="hidden" name="user" value="{{ user.id }}">
{% if status %}
<input type="hidden" name="statuses" value="{{ status.id }}">
{% endif %}
<section class="content">
<p>{% blocktrans with site_name=site.name %}This report will be sent to {{ site_name }}'s moderators for review.{% endblocktrans %}</p>
<label class="label" for="id_{{ controls_uid }}_report_note">{% trans "More info about this report:" %}</label>
<textarea class="textarea" name="note" id="id_{{ controls_uid }}_report_note"></textarea>
</section>
{% endblock %}
{% block modal-footer %}
<button class="button is-success" type="submit">{% trans "Submit" %}</button>
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="report" controls_uid=report_uuid class="" %}
{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View File

@ -1,41 +0,0 @@
{% load i18n %}
<div class="columns is-mobile is-gapless">
<div class="column is-cover">
{% include 'snippets/book_cover.html' with book=result cover_class='is-w-xs is-h-xs' external_path=True %}
</div>
<div class="column is-10 ml-3">
<p>
<strong>
<a
href="{{ result.view_link|default:result.key }}"
{% if remote_result %}
rel="noopener"
target="_blank"
{% endif %}
>{{ result.title }}</a>
</strong>
</p>
<p>
{% if result.author %}
{{ result.author }}
{% endif %}
{% if result.year %}
({{ result.year }})
{% endif %}
</p>
{% if remote_result %}
<form class="mt-1" action="/resolve-book" method="post">
{% csrf_token %}
<input type="hidden" name="remote_id" value="{{ result.key }}">
<button type="submit" class="button is-small is-link">
{% trans "Import book" %}
</button>
</form>
{% endif %}
</div>
</div>

View File

@ -25,7 +25,7 @@
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid readthrough=readthrough %}
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book.book controls_text="progress_update" controls_uid=uuid readthrough=readthrough %}
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book controls_text="progress_update" controls_uid=uuid readthrough=readthrough %}
{% endwith %}
{% endif %}

View File

@ -32,7 +32,7 @@
{% include "snippets/status/header_content.html" %}
</h3>
<p class="is-size-7 is-flex is-align-items-center">
<a href="{{ status.remote_id }}">{{ status.published_date|published_date }}</a>
<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' %}

View File

@ -3,7 +3,10 @@
{% load utilities %}
{% block card-header %}
<div class="card-header-title has-background-white-ter is-block">
<div
class="card-header-title has-background-white-ter is-block"
{% if main %}id="anchor-{{ status.id }}"{% endif %}
>
{% include 'snippets/status/header.html' with status=status %}
</div>
{% endblock %}

View File

@ -11,7 +11,7 @@
{% if status.user == request.user %}
{# things you can do to your own statuses #}
<li role="menuitem" class="dropdown-item p-0">
<form name="delete-{{ status.id }}" action="/delete-status/{{ status.id }}" method="post">
<form name="delete-{{ status.id|uuid }}" action="/delete-status/{{ status.id }}" method="post">
{% csrf_token %}
<button class="button is-radiusless is-danger is-light is-fullwidth is-small" type="submit">
{% trans "Delete status" %}

View File

@ -1,5 +1,6 @@
{% load utilities %}
{% if fallback_url %}
<form name="fallback-form-{{ controls_uuid}}" method="GET" action="{{ fallback_url }}">
<form name="fallback_form_{{ 0|uuid }}" method="GET" action="{{ fallback_url }}">
{% endif %}
<button
{% if not fallback_url %}