Merge branch 'main' into edit-book-fields

This commit is contained in:
Mouse Reeve 2021-03-01 11:53:02 -08:00
commit 99288e9183
81 changed files with 2272 additions and 424 deletions

View file

@ -10,6 +10,7 @@ WORKDIR /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt
RUN apt-get update && apt-get install -y gettext libgettextpo-dev
COPY ./bookwyrm /app
COPY ./celerywyrm /app

View file

@ -140,6 +140,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
LANGUAGES = [
('en-us', _('English')),
('fr-fr', _('French')),
]

View file

@ -1,6 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block title %}{{ author.name }}{% endblock %}
{% block content %}
<div class="block">
<div class="columns is-mobile">

View file

@ -2,8 +2,10 @@
{% load i18n %}
{% load bookwyrm_tags %}
{% load humanize %}
{% block content %}
{% block title %}{{ book.title }}{% endblock %}
{% block content %}
<div class="block">
<div class="columns is-mobile">
<div class="column">
@ -93,7 +95,8 @@
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
{% if request.user.is_authenticated and perms.bookwyrm.edit_book and not book|book_description %}
{% include 'snippets/toggle/open_button.html' with text="Add description" controls_text="add-description" controls_uid=book.id focus="id_description" hide_active=True id="hide-description" %}
{% trans 'Add Description' as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text controls_text="add-description" controls_uid=book.id focus="id_description" hide_active=True id="hide-description" %}
<div class="box hidden" id="add-description-{{ book.id }}">
<form name="add-description" method="POST" action="/add-description/{{ book.id }}">
@ -104,7 +107,8 @@
</p>
<div class="field">
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="add-description" controls_uid=book.id hide_inactive=True %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="add-description" controls_uid=book.id hide_inactive=True %}
</div>
</form>
</div>
@ -137,7 +141,8 @@
<header class="columns">
<h2 class="column title is-5 mb-1">{% trans "Your reading activity" %}</h2>
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Add read dates" icon="plus" class="is-small" controls_text="add-readthrough" %}
{% trans "Add read dates" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="plus" class="is-small" controls_text="add-readthrough" %}
</div>
</header>
{% if not readthroughs.exists %}
@ -151,7 +156,8 @@
<button class="button is-primary" type="submit">{% trans "Create" %}</button>
</div>
<div class="control">
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="add-readthrough" %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="add-readthrough" %}
</div>
</div>
</form>

View file

@ -1,10 +1,12 @@
{% load i18n %}
<section class="card hidden {{ class }}" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}">
<header class="card-header has-background-white-ter">
<h2 class="card-header-title" tabindex="0" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}-header">
{% block header %}{% endblock %}
</h2>
<span class="card-header-icon">
{% include 'snippets/toggle/toggle_button.html' with label="Close" class="delete" nonbutton=True controls_text=controls_text %}
{% trans "Close" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with label=button_text class="delete" nonbutton=True controls_text=controls_text %}
</span>
</header>
<section class="card-content content">

View file

@ -1,10 +1,10 @@
{% extends 'discover/landing_layout.html' %}
{% load i18n %}
{% block panel %}
{% block panel %}
<div class="block columns mt-4">
<nav class="menu column is-one-quarter">
<h2 class="menu-label">About {{ site.name }}</h2>
<h2 class="menu-label">{% blocktrans with site_name=site.name %}About {{ site_name }}{% endblocktrans %}</h2>
<ul class="menu-list">
<li>
<a href="#coc">{% trans "Code of Conduct" %}</a>

View file

@ -1,8 +1,10 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block content %}
{% block title %}{% trans "Welcome" %}{% endblock %}
{% block content %}
<header class="block has-text-centered">
<h1 class="title">{{ site.name }}</h1>
<h2 class="subtitle">{{ site.instance_tagline }}</h2>

View file

@ -1,6 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Edit Author" %}: {{ author.name }}{% endblock %}
{% block content %}
<header class="block">
<h1 class="title level-left">

View file

@ -1,6 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Edit Book" %}{% endblock %}
{% block content %}
<header class="block">
<h1 class="title level-left">

View file

@ -1,6 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block title %}{% blocktrans with book_title=work.title %}Editions of {{ book_title }}{% endblocktrans %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% blocktrans with path=work.local_path work_title=work.title %}Editions of <a href="{{ work_path }}">"{{ work_title }}"</a>{% endblocktrans %}</h1>

View file

@ -1,11 +1,12 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block content %}
{% block title %}{% trans "Oops!" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% trans "Server Error" %}</h1>
<p>{% trans "Something went wrong! Sorry about that." %}</p>
</div>
{% endblock %}

View file

@ -3,7 +3,13 @@
{% block panel %}
<header class="block">
<h1 class="title">Direct Messages{% if partner %} with {% include 'snippets/username.html' with user=partner %}{% endif %}</h1>
<h1 class="title">
{% if partner %}
{% blocktrans with username=partner.display_name path=partner.local_path %}Direct Messages with <a href="{{ path }}">{{ username }}</a>{% endblocktrans %}
{% else %}
{% trans "Direct Messages" %}
{% endif %}
</h1>
{% if partner %}<p class="subtitle"><a href="/direct-messages"><span class="icon icon-arrow-left" aria-hidden="true"></span> {% trans "All messages" %}</a></p>{% endif %}
</header>

View file

@ -1,8 +1,10 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block content %}
{% block title %}{% trans "Updates" %}{% endblock %}
{% block content %}
<div class="columns">
{% if user.is_authenticated %}
<div class="column is-one-third">
@ -46,7 +48,8 @@
<span>{% include 'snippets/book_titleby.html' with book=book %}</span>
</p>
<div class="card-header-icon is-hidden-tablet">
{% include 'snippets/toggle/toggle_button.html' with label="close" controls_text="book" controls_uid=book.id class="delete" nonbutton=True pressed=True %}
{% trans "Close" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with label=button_text controls_text="book" controls_uid=book.id class="delete" nonbutton=True pressed=True %}
</div>
</div>
<div class="card-content">

View file

@ -1,5 +1,6 @@
{% extends 'feed/feed_layout.html' %}
{% load i18n %}
{% block panel %}
<header class="block">
<a href="/#feed" class="button" data-back>

View file

@ -8,7 +8,8 @@
</div>
{% if is_self and goal %}
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Edit goal" icon="pencil" controls_text="show-edit-goal" focus="edit-form-header" %}
{% trans "Edit Goal" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="pencil" controls_text="show-edit-goal" focus="edit-form-header" %}
</div>
{% endif %}
</div>
@ -22,7 +23,7 @@
<section class="card {% if goal %}hidden{% endif %}" id="show-edit-goal">
<header class="card-header">
<h2 class="card-header-title has-background-primary has-text-white" tabindex="0" id="edit-form-header">
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span> {{ year }} reading goal
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span> {% blocktrans %}{{ year }} Reading Goal{% endblocktrans %}
</h2>
</header>
<section class="card-content content">
@ -45,7 +46,13 @@
{% if goal.books %}
<section class="content">
<h2>{% if goal.user == request.user %}Your{% else %}{{ goal.user.display_name }}'s{% endif %} {{ year }} Books</h2>
<h2>
{% if goal.user == request.user %}
{% blocktrans %}Your {{ year }} Books{% endblocktrans %}
{% else %}
{% blocktrans with username=goal.user.display_name %}{{ username }}'s {{ year }} Books{% endblocktrans %}
{% endif %}
</h2>
<div class="columns is-multiline">
{% for book in goal.books %}
<div class="column is-narrow">

View file

@ -1,6 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Import Books" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% trans "Import Books" %}</h1>

View file

@ -2,6 +2,9 @@
{% load i18n %}
{% load bookwyrm_tags %}
{% load humanize %}
{% block title %}{% trans "Import Status" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% trans "Import Status" %}</h1>

View file

@ -1,5 +1,8 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}{% trans "Create an Account" %}{% endblock %}
{% block content %}
<div class="columns">

View file

@ -3,7 +3,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% if title %}{{ title }} | {% endif %}{{ site.name }}</title>
<title>{% block title %}BookWyrm{% endblock %} | {{ site.name }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="/static/css/bulma.min.css">
<link type="text/css" rel="stylesheet" href="/static/css/format.css">
@ -30,7 +30,7 @@
<form class="navbar-item column" action="/search/">
<div class="field has-addons">
<div class="control">
<input aria-label="Search for a book or user" id="search-input" class="input" type="text" name="q" placeholder="Search for a book or user" value="{{ query }}">
<input aria-label="{% trans 'Search for a book or user' %}" id="search-input" class="input" type="text" name="q" placeholder="{% trans 'Search for a book or user' %}" value="{{ query }}">
</div>
<div class="control">
<button class="button" type="submit">
@ -76,22 +76,22 @@
<ul class="navbar-dropdown" id="navbar-dropdown">
<li>
<a href="/direct-messages" class="navbar-item">
Direct messages
{% trans "Direct Messages" %}
</a>
</li>
<li>
<a href="/user/{{request.user.localname}}" class="navbar-item">
Profile
{% trans 'Profile' %}
</a>
</li>
<li>
<a href="/preferences/profile" class="navbar-item">
Settings
{% trans 'Settings' %}
</a>
</li>
<li>
<a href="/import" class="navbar-item">
Import books
{% trans 'Import Books' %}
</a>
</li>
{% if perms.bookwyrm.create_invites or perms.bookwyrm.edit_instance_settings%}
@ -100,21 +100,21 @@
{% if perms.bookwyrm.create_invites %}
<li>
<a href="{% url 'settings-invites' %}" class="navbar-item">
Invites
{% trans 'Invites' %}
</a>
</li>
{% endif %}
{% if perms.bookwyrm.edit_instance_settings %}
<li>
<a href="{% url 'settings-site' %}" class="navbar-item">
Site Configuration
{% trans 'Site Configuration' %}
</a>
</li>
{% endif %}
<hr class="navbar-divider">
<li>
<a href="/logout" class="navbar-item">
Log out
{% trans 'Log out' %}
</a>
</li>
</ul>
@ -195,7 +195,7 @@
</div>
{% endif %}
<div class="column">
BookWyrm is open source software. You can contribute or report issues on <a href="https://github.com/mouse-reeve/bookwyrm">GitHub</a>.
{% trans 'BookWyrm is open source software. You can contribute or report issues on <a href="https://github.com/mouse-reeve/bookwyrm">GitHub</a>.' %}
</div>
</div>
</div>

View file

@ -1,8 +1,8 @@
{% extends 'lists/list_layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block panel %}
{% block panel %}
{% if request.user == list.user and pending_count %}
<div class="block content">
<p>

View file

@ -1,8 +1,10 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block content %}
{% block title %}{{ list.name }}{% endblock %}
{% block content %}
<header class="columns content is-mobile">
<div class="column">
<h1 class="title">{{ list.name }} <span class="subtitle">{% include 'snippets/privacy-icons.html' with item=list %}</span></h1>
@ -12,7 +14,8 @@
</div>
{% if request.user == list.user %}
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Edit list" icon="pencil" controls_text="edit-list" focus="edit-list-header" %}
{% trans "Edit List" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="pencil" controls_text="edit-list" focus="edit-list-header" %}
</div>
{% endif %}
</header>

View file

@ -1,5 +1,8 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}{% trans "Lists" %}{% endblock %}
{% block content %}
<header class="block">
@ -11,7 +14,8 @@
<h2 class="title">{% trans "Your lists" %}</h2>
</div>
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text="Create new list" focus="create-list-header" %}
{% trans "Create List" as button_text %}
{% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text=button_text focus="create-list-header" %}
</div>
</header>

View file

@ -1,7 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block content %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
<div class="columns">
<div class="column">
<div class="box">

View file

@ -1,10 +1,11 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block content %}
{% block title %}{% trans "Not Found" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% trans "Not Found" %}</h1>
<p>{% trans "The page your requested doesn't seem to exist!" %}</p>
</div>
{% endblock %}

View file

@ -2,6 +2,9 @@
{% load i18n %}
{% load humanize %}
{% load bookwyrm_tags %}
{% block title %}{% trans "Notifications" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% trans "Notifications" %}</h1>
@ -42,13 +45,37 @@
{% include 'snippets/avatar.html' with user=notification.related_user %}
{% include 'snippets/username.html' with user=notification.related_user %}
{% if notification.notification_type == 'FAVORITE' %}
{% blocktrans with preview_name=related_status|status_preview_name|safe related_path=related_status.local_path %}favorited your <a href="{{ related_path }}">{{ preview_name }}</a>{% endblocktrans %}
{% if related_status.status_type == 'Review' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>{% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path %}favorited your <a href="{{ related_path }}">status</a>{% endblocktrans %}
{% endif %}
{% elif notification.notification_type == 'MENTION' %}
{% blocktrans with preview_name=related_status|status_preview_name|safe related_path=related_status.local_path %}mentioned you in a <a href="{{ related_path }}">{{ preview_name }}</a>{% endblocktrans %}
{% if related_status.status_type == 'Review' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>{% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path %}mentioned you in a <a href="{{ related_path }}">status</a>{% endblocktrans %}
{% endif %}
{% elif notification.notification_type == 'REPLY' %}
{% blocktrans with preview_name=related_status|status_preview_name|safe related_path=related_status.local_path parent_path=related_status.reply_parent.local_path %}<a href="{{ related_path }}">replied</a> to your <a href="{{ parent_path }}">{{ preview_name }}</a>{% endblocktrans %}
{% if related_status.status_type == 'Review' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}<a href="{{ related_path }}">replied</a> to your <a href="{{ parent_path }}">review of <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}<a href="{{ related_path }}">replied</a> to your <a href="{{ parent_path }}">comment on <em>{{ book_title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}<a href="{{ related_path }}">replied</a> to your <a href="{{ parent_path }}">quote from <em>{{ book_title }}</em></a>{% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path %}<a href="{{ related_path }}">replied</a> to your <a href="{{ parent_path }}">status</a>{% endblocktrans %}
{% endif %}
{% elif notification.notification_type == 'FOLLOW' %}
{% trans "followed you" %}
@ -59,9 +86,21 @@
{% include 'snippets/follow_request_buttons.html' with user=notification.related_user %}
</div>
{% elif notification.notification_type == 'BOOST' %}
{% blocktrans with preview_name=related_status|status_preview_name|safe related_path=related_status.local_path %}boosted your <a href="{{ related_path }}">{{ preview_name }}</a>{% endblocktrans %}
{% if related_status.status_type == 'Review' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your <a href="{{ related_path }}">review of <em>{{ book.title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your <a href="{{ related_path }}">comment on<em>{{ book.title }}</em></a>{% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your <a href="{{ related_path }}">quote from <em>{{ book.title }}</em></a>{% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path %}boosted your <a href="{{ related_path }}">status</a>{% endblocktrans %}
{% endif %}
{% elif notification.notification_type == 'ADD' %}
{% if notification.related_list_item.approved %}{% trans "added" %}{% else %}{% trans "suggested adding" %}{% endif %} {% include 'snippets/book_titleby.html' with book=notification.related_list_item.book %} to your list "<a href="{{ notification.related_list_item.book_list.local_path }}{% if not notification.related_list_item.approved %}/curate{% endif %}">{{ notification.related_list_item.book_list.name }}</a>"
{% if notification.related_list_item.approved %}
{% blocktrans with book_path=notification.related_list_item.book.local_path book_title=notification.related_list_item.book.title list_path=notification.related_list_item.book_list.local_path list_name=notification.related_list_item.book_list.name %} added <em><a href="{{ book_path }}">{{ book_title }}</a></em> to your list "<a href="{{ list_path }}">{{ list_name }}</a>"{% endblocktrans %}
{% else %}
{% blocktrans with book_path=notification.related_list_item.book.local_path book_title=notification.related_list_item.book.title list_path=notification.related_list_item.book_list.local_path list_name=notification.related_list_item.book_list.name %} suggested adding <em><a href="{{ book_path }}">{{ book_title }}</a></em> to your list "<a href="{{ list_path }}/curate">{{ list_name }}</a>"{% endblocktrans %}
{% endif %}
{% endif %}
{% elif notification.related_import %}
{% blocktrans with related_id=notification.related_import.id %} your <a href="/import/{{ related_id }}">import</a> completed.{% endblocktrans %}

View file

@ -1,7 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block content %}
{% block title %}{% trans "Reset Password" %}{% endblock %}
{% block content %}
<div class="columns">
<div class="column">
<div class="block">

View file

@ -1,7 +1,9 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block content %}
{% block title %}{% trans "Reset Password" %}{% endblock %}
{% block content %}
<div class="columns is-centered">
<div class="column is-half">
<div class="block">

View file

@ -1,6 +1,8 @@
{% extends 'preferences/preferences_layout.html' %}
{% load i18n %}
{% block title %}{% trans "Blocked Users" %}{{ author.name }}{% endblock %}
{% block header %}
{% trans "Blocked Users" %}
{% endblock %}

View file

@ -1,5 +1,8 @@
{% extends 'preferences/preferences_layout.html' %}
{% load i18n %}
{% block title %}{% trans "Change Password" %}{% endblock %}
{% block header %}
{% trans "Change Password" %}
{% endblock %}
@ -15,6 +18,6 @@
<label class="label" for="id_confirm_password">{% trans "Confirm password:" %}</label>
<input type="password" name="confirm-password" maxlength="128" class="input" required="" id="id_confirm_password">
</div>
<button class="button is-primary" type="submit">{% trans "Change password" %}</button>
<button class="button is-primary" type="submit">{% trans "Change Password" %}</button>
</form>
{% endblock %}

View file

@ -1,5 +1,8 @@
{% extends 'preferences/preferences_layout.html' %}
{% load i18n %}
{% block title %}{% trans "Edit Profile" %}{% endblock %}
{% block header %}
{% trans "Edit Profile" %}
{% endblock %}

View file

@ -14,13 +14,13 @@
<a href="/preferences/profile"{% if '/preferences/profile' in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Profile" %}</a>
</li>
<li>
<a href="/preferences/password"{% if '/preferences/password' in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Change password" %}</a>
<a href="/preferences/password"{% if '/preferences/password' in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Change Password" %}</a>
</li>
</ul>
<h2 class="menu-label">{% trans "Relationships" %}</h2>
<ul class="menu-list">
<li>
<a href="/preferences/block"{% if '/preferences/block' in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Blocked users" %}</a>
<a href="/preferences/block"{% if '/preferences/block' in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Blocked Users" %}</a>
</li>
</ul>
</nav>

View file

@ -1,5 +1,8 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}{% trans "Search Results" %}{% endblock %}
{% block content %}
{% with book_results|first as local_results %}
<div class="block">
@ -29,7 +32,8 @@
<p>
{% trans "Didn't find what you were looking for?" %}
</p>
{% include 'snippets/toggle/open_button.html' with text="Show results from other catalogues" small=True controls_text="more-results" %}
{% trans "Show results from other catalogues" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text small=True controls_text="more-results" %}
</div>
{% endif %}
@ -60,7 +64,8 @@
{% endfor %}
{% if local_results.results %}
{% include 'snippets/toggle/close_button.html' with text="Hide results from other catalogues" small=True controls_text="more-results" %}
{% trans "Hide results from other catalogues" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text small=True controls_text="more-results" %}
{% endif %}
</div>
{% endif %}

View file

@ -1,5 +1,8 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}{% trans "Administration" %}{% endblock %}
{% block content %}
<header class="block column is-offset-one-quarter pl-1">
@ -26,7 +29,7 @@
<ul class="menu-list">
<li>
{% url 'settings-site' as url %}
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Site Configuration" %}</a>
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Site Settings" %}</a>
{% if url in request.path %}
<ul class="emnu-list">
<li><a href="{{ url }}#instance-info">{% trans "Instance Info" %}</a></li>

View file

@ -1,5 +1,6 @@
{% extends 'settings/admin_layout.html' %}
{% load i18n %}
{% block header %}{% trans "Federated Servers" %}{% endblock %}
{% block panel %}

View file

@ -1,6 +1,9 @@
{% extends 'settings/admin_layout.html' %}
{% load i18n %}
{% block header %}{% trans "Site Configuration" %}{% endblock %}
{% block title %}{% trans "Site Settings" %}{% endblock %}
{% block header %}{% trans "Site Settings" %}{% endblock %}
{% block panel %}

View file

@ -1,5 +1,7 @@
<a href="/book/{{ book.id }}">{{ book.title }}</a>
{% load i18n %}
{% if book.authors %}
by {% include 'snippets/authors.html' with book=book %}
{% blocktrans with path=book.local_path title=book.title %}<a href="{{ path }}">{{ title }}</a> by {% endblocktrans %}{% include 'snippets/authors.html' with book=book %}
{% else %}
<a href="{{ book.local_path }}">{{ book.title }}</a>
{% endif %}

View file

@ -7,7 +7,7 @@
<input type="hidden" name="reply_parent" value="{{ reply_parent.id }}">
{% if type == 'review' %}
<div class="control">
<label class="label" for="id_name_{{ book.id }}_{{ type }}">{% trans "Title:" %}</label>
<label class="label" for="id_name_{{ book.id }}_{{ type }}">{% trans "Title" %}:</label>
<input type="text" name="name" maxlength="255" class="input" required="" id="id_name_{{ book.id }}_{{ type }}" placeholder="My {{ type }} of '{{ book.title }}'">
</div>
{% endif %}
@ -41,7 +41,7 @@
</div>
{% if type == 'quotation' %}
<div class="control">
<label class="label" for="id_content_quote-{{ book.id }}">{% trans "Comment:" %}</label>
<label class="label" for="id_content_quote-{{ book.id }}">{% trans "Comment" %}:</label>
{% include 'snippets/content_warning_field.html' with parent_status=status %}
<textarea name="content" class="textarea is-small" id="id_content_quote-{{ book.id }}"></textarea>
</div>
@ -51,7 +51,8 @@
<div class="columns pt-1">
<div class="field has-addons column">
<div class="control">
{% include 'snippets/toggle/toggle_button.html' with text="Include spoiler alert" icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=status.content_warning %}
{% trans "Include spoiler alert" as button_text %}
{% 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=status.content_warning %}
</div>
<div class="control">
{% if type == 'direct' %}

View file

@ -14,6 +14,7 @@
<button class="button is-danger" type="submit">
{% trans "Delete" %}
</button>
{% include 'snippets/toggle/toggle_button.html' with text="Cancel" controls_text="delete-readthrough" controls_uid=readthrough.id %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="delete-readthrough" controls_uid=readthrough.id %}
</form>
{% endblock %}

View file

@ -1 +1 @@
{% load humanize %}set a goal to read {{ goal.goal | intcomma }} book{{ goal.goal | pluralize }} in {{ goal.year }}
{% load i18n %}{% load humanize %}{% blocktrans count counter=goal.goal with counter=goal.goal year=goal.year %}set a goal to read {{ counter }} book in {{ year }}{% plural %}set a goal to read {{ counter }} books in {{ year }}{% endblocktrans %}

View file

@ -3,7 +3,7 @@
{% 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 %}
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span> {% blocktrans %}{{ year }} Reading Goal{% endblocktrans %}
</h3>
{% endblock %}

View file

@ -29,7 +29,8 @@
<p>
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
{% if goal %}
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="show-edit-goal" %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="show-edit-goal" %}
{% endif %}
</p>
</form>

View file

@ -4,9 +4,13 @@
{% if goal.progress_percent >= 100 %}
{% trans "Success!" %}
{% elif goal.progress_percent %}
{% blocktrans with percent=goal.percent %}{{ percent }}% complete!{% endblocktrans %}
{% blocktrans with percent=goal.progress_percent %}{{ percent }}% complete!{% endblocktrans %}
{% endif %}
{% if goal.user == request.user %}
{% blocktrans with read_count=goal.book_count|intcomma goal_count=goal.goal|intcomma path=goal.local_path %}You've read <a href="{{ path }}">{{ read_count }} of {{ goal_count}} books</a>.{% endblocktrans %}
{% else %}
{% blocktrans with username=goal.user.display_name read_count=goal.book_count|intcomma goal_count=goal.goal|intcomma path=goal.local_path %}{{ username }} has read <a href="{{ path }}">{{ read_count }} of {{ goal_count}} books</a>.{% endblocktrans %}
{% endif %}
{% if goal.user == request.user %}You've{% else %}{{ goal.user.display_name }} has{% endif %} read {% if request.path != goal.local_path %}<a href="{{ goal.local_path }}">{% endif %}{{ goal.book_count }} of {{ goal.goal | intcomma }} books{% if request.path != goal.local_path %}</a>{% endif %}.
</p>
<progress class="progress is-large" value="{{ goal.book_count }}" max="{{ goal.goal }}" aria-hidden="true">{{ goal.progress_percent }}%</progress>

View file

@ -11,7 +11,8 @@
<li>{% if readthrough.finish_date %} {{ readthrough.finish_date | naturalday }}: {% trans "finished" %} {% else %}{% if readthrough.progress_mode == 'PG' %}on page {{ readthrough.progress }}{% if book.pages %} of {{ book.pages }}{% endif %}
{% else %}{{ readthrough.progress }}%{% endif %}{% endif %}
{% if readthrough.progress %}
{% include 'snippets/toggle/toggle_button.html' with text="Show all updates" controls_text="updates" controls_uid=readthrough.id class="is-small" %}
{% trans "Show all updates" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="updates" controls_uid=readthrough.id class="is-small" %}
<ul id="updates-{{ readthrough.id }}" class="hidden">
{% for progress_update in readthrough.progress_updates %}
<li>
@ -42,10 +43,12 @@
<div class="column is-narrow">
<div class="field has-addons">
<div class="control">
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="Edit read dates" icon="pencil" controls_text="edit-readthrough" controls_uid=readthrough.id focus="edit-readthrough" %}
{% trans "Edit read dates" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text=button_text icon="pencil" controls_text="edit-readthrough" controls_uid=readthrough.id focus="edit-readthrough" %}
</div>
<div class="control">
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="Delete these read dates" icon="x" controls_text="delete-readthrough" controls_uid=readthrough.id focus="modal-title-delete-readthrough" %}
{% trans "Delete these read dates" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text=button_text icon="x" controls_text="delete-readthrough" controls_uid=readthrough.id focus="modal-title-delete-readthrough" %}
</div>
</div>
</div>
@ -59,7 +62,8 @@
{% include 'snippets/readthrough_form.html' with readthrough=readthrough %}
<div class="field is-grouped">
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="edit-readthrough" controls_uid=readthrough.id %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="edit-readthrough" controls_uid=readthrough.id %}
</div>
</form>
</div>

View file

@ -40,7 +40,8 @@
</div>
<div class="column">
<button type="submit" class="button is-success">{% trans "Save" %}</button>
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="finish-reading" controls_uid=uuid %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="finish-reading" controls_uid=uuid %}
</div>
</div>
{% endblock %}

View file

@ -5,13 +5,16 @@
{% if dropdown %}<li role="menuitem">{% endif %}
<div class="{% if dropdown %}dropdown-item pt-0 pb-0{% elif active_shelf.shelf.identifier|next_shelf != shelf.identifier %}hidden{% endif %}">
{% if shelf.identifier == 'reading' %}{% if not dropdown or active_shelf.shelf.identifier|next_shelf != shelf.identifier %}
{% include 'snippets/toggle/toggle_button.html' with class=class text="Start reading" controls_text="start-reading" controls_uid=button_uuid focus="modal-title-start-reading" disabled=is_current %}
{% trans "Start reading" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="start-reading" controls_uid=button_uuid focus="modal-title-start-reading" disabled=is_current %}
{% endif %}{% elif shelf.identifier == 'read' and active_shelf.shelf.identifier == 'read' %}{% if not dropdown or active_shelf.shelf.identifier|next_shelf != shelf.identifier %}
<button type="button" class="button {{ class }}" disabled><span>{% trans "Read" %}</span>
{% endif %}{% elif shelf.identifier == 'read' %}{% if not dropdown or active_shelf.shelf.identifier|next_shelf != shelf.identifier %}
{% include 'snippets/toggle/toggle_button.html' with class=class text="Finish reading" controls_text="finish-reading" controls_uid=button_uuid focus="modal-title-finish-reading" disabled=is_current %}
{% trans "Finish reading" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="finish-reading" controls_uid=button_uuid focus="modal-title-finish-reading" disabled=is_current %}
{% endif %}{% elif shelf.identifier == 'to-read' %}{% if not dropdown or active_shelf.shelf.identifier|next_shelf != shelf.identifier %}
{% include 'snippets/toggle/toggle_button.html' with class=class text="Want to read" controls_text="want-to-read" controls_uid=button_uuid focus="modal-title-want-to-read" disabled=is_current %}
{% trans "Want to read" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="want-to-read" controls_uid=button_uuid focus="modal-title-want-to-read" disabled=is_current %}
{% endif %}{% elif shelf.editable %}
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}

View file

@ -32,7 +32,8 @@
</div>
<div class="column">
<button class="button is-success" type="submit">{% trans "Save" %}</button>
{% include 'snippets/toggle/toggle_button.html' with text="Cancel" controls_text="start-reading" controls_uid=uuid %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="start-reading" controls_uid=uuid %}
</div>
</div>
{% endblock %}

View file

@ -25,7 +25,8 @@
<button class="button is-success" type="submit">
<span>{% trans "Want to read" %}</span>
</button>
{% include 'snippets/toggle/toggle_button.html' with text="Cancel" controls_text="want-to-read" controls_uid=uuid %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="want-to-read" controls_uid=uuid %}
</div>
</div>
{% endblock %}

View file

@ -21,7 +21,8 @@
{% if request.user.is_authenticated %}
<div class="field has-addons">
<div class="control">
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text="Reply" icon="comment" class="is-small toggle-button" focus="id_content_reply" %}
{% trans "Reply" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text=button_text icon="comment" class="is-small toggle-button" focus="id_content_reply" %}
</div>
<div class="control">
{% include 'snippets/boost_button.html' with status=status %}

View file

@ -13,13 +13,15 @@
{% if status.content_warning %}
<div>
<p>{{ status.content_warning }}</p>
{% include 'snippets/toggle/open_button.html' with text="show more" class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
{% trans "Show more" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
</div>
{% endif %}
<div{% if status.content_warning %} class="hidden" id="show-status-cw-{{ status.id }}"{% endif %}>
{% if status.content_warning %}
{% include 'snippets/toggle/close_button.html' with text="show less" class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
{% trans "Show less" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
{% endif %}
{% if status.quote %}

View file

@ -1,4 +1,6 @@
{% load bookwyrm_tags %}
{% load i18n %}
{% with 0|uuid as uuid %}
{% if full %}
{% with full|to_markdown|safe as full %}
@ -7,12 +9,14 @@
{% if trimmed != full %}
<div id="hide-full-{{ uuid }}">
<div class="content" id="trimmed-{{ uuid }}"><span dir="auto">{{ trimmed }}</span>
{% include 'snippets/toggle/open_button.html' with text="show more" controls_text="full" controls_uid=uuid class="is-small" %}
{% trans "Show more" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text controls_text="full" controls_uid=uuid class="is-small" %}
</div>
</div>
<div id="full-{{ uuid }}" class="hidden">
<div class="content"><span dir="auto">{{ full }}</span>
{% include 'snippets/toggle/close_button.html' with text="show less" controls_text="full" controls_uid=uuid class="is-small" %}
{% trans "Show less" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="full" controls_uid=uuid class="is-small" %}
</div>
</div>
{% else %}

View file

@ -1,13 +1,14 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block content %}
{% block title %}{{ tag.name }}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">{% blocktrans %}Books tagged "{{ tag.name }}"{% endblocktrans %}</h1>
{% include 'snippets/book_tiles.html' with books=books.all %}
</div>
{% endblock %}

View file

@ -4,11 +4,7 @@
{% block header %}
<h1 class="title">
{% if is_self %}Your
{% else %}
{% include 'snippets/username.html' with user=user possessive=True %}
{% endif %}
followers
{% trans "User Profile" %}
</h1>
{% endblock %}

View file

@ -4,11 +4,7 @@
{% block header %}
<h1 class="title">
Users following
{% if is_self %}you
{% else %}
{% include 'snippets/username.html' with user=user %}
{% endif %}
{% trans "User Profile" %}
</h1>
{% endblock %}

View file

@ -5,16 +5,17 @@
<div class="columns is-mobile">
<div class="column">
<h1 class="title">
{% if is_self %}Your
{% if is_self %}
{% trans "Your Lists" %}
{% else %}
{% include 'snippets/username.html' with user=user %}'s
{% blocktrans with username=user.display_name %}Lists: {{ username }}{% endblocktrans %}
{% endif %}
Lists
</h1>
</div>
{% if is_self %}
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text="Create new list" %}
{% trans "Create new list" as button_text %}
{% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text=button_text %}
</div>
{% endif %}
</div>

View file

@ -1,14 +1,15 @@
{% extends 'user/user_layout.html' %}
{% load bookwyrm_tags %}
{% load i18n %}
{% block header %}
<header class="columns">
<h1 class="title">
{% if is_self %}Your
{% if is_self %}
{% trans "Your Shelves" %}
{% else %}
{% include 'snippets/username.html' with user=user possessive=True %}
{% blocktrans with username=user.display_name %}{{ username }}: Shelves{% endblocktrans %}
{% endif %}
shelves
</h1>
</header>
{% endblock %}
@ -29,7 +30,8 @@
{% if is_self %}
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Create shelf" icon="plus" controls_text="create-shelf-form" focus="create-shelf-form-header" %}
{% trans "Create shelf" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="plus" controls_text="create-shelf-form" focus="create-shelf-form-header" %}
</div>
{% endif %}
</div>
@ -49,7 +51,8 @@
</div>
{% if is_self %}
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Edit shelf" icon="pencil" controls_text="edit-shelf-form" focus="edit-shelf-form-header" %}
{% trans "Edit shelf" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="pencil" controls_text="edit-shelf-form" focus="edit-shelf-form-header" %}
</div>
{% endif %}
</div>

View file

@ -1,10 +1,12 @@
{% extends 'user/user_layout.html' %}
{% load i18n %}
{% block title %}{{ user.name }}{% endblock %}
{% block header %}
<div class="columns is-mobile">
<div class="column">
<h1 class="title">{% trans "User profile" %}</h1>
<h1 class="title">{% trans "User Profile" %}</h1>
</div>
{% if is_self %}
<div class="column is-narrow">

View file

@ -3,6 +3,8 @@
{% load humanize %}
{% load bookwyrm_tags %}
{% block title %}{{ user.display_name }}{% endblock %}
{% block content %}
<header class="block">
{% block header %}{% endblock %}

View file

@ -12,8 +12,8 @@
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
<p>{% blocktrans with date=user.created_date|naturaltime %}Joined {{ date }}{% endblocktrans %}</p>
<p>
<a href="{{ user.local_path }}/followers">{{ user.followers.count }} follower{{ user.followers.count | pluralize }}</a>,
<a href="{{ user.local_path }}/following">{{ user.following.count }} following</a>
<a href="{{ user.local_path }}/followers">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
<a href="{{ user.local_path }}/following">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
</p>
</div>
</div>

View file

@ -6,6 +6,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views import View
from bookwyrm import forms, models
@ -13,6 +14,7 @@ from bookwyrm.settings import DOMAIN
# pylint: disable= no-self-use
@method_decorator(csrf_exempt, name='dispatch')
class Login(View):
''' authenticate an existing user '''
def get(self, request):
@ -21,7 +23,6 @@ class Login(View):
return redirect('/')
# sene user to the login page
data = {
'title': 'Login',
'login_form': forms.LoginForm(),
'register_form': forms.RegisterForm(),
}
@ -29,6 +30,8 @@ class Login(View):
def post(self, request):
''' authentication action '''
if request.user.is_authenticated:
return redirect('/')
login_form = forms.LoginForm(request.POST)
localname = login_form.data['localname']

View file

@ -24,7 +24,6 @@ class Author(View):
books = models.Work.objects.filter(
Q(authors=author) | Q(editions__authors=author)).distinct()
data = {
'title': author.name,
'author': author,
'books': [b.get_default_edition() for b in books],
}
@ -41,7 +40,6 @@ class EditAuthor(View):
''' info about a book '''
author = get_object_or_404(models.Author, id=author_id)
data = {
'title': 'Edit Author',
'author': author,
'form': forms.AuthorForm(instance=author)
}
@ -54,7 +52,6 @@ class EditAuthor(View):
form = forms.AuthorForm(request.POST, request.FILES, instance=author)
if not form.is_valid():
data = {
'title': 'Edit Author',
'author': author,
'form': form
}

View file

@ -15,8 +15,7 @@ class Block(View):
''' blocking users '''
def get(self, request):
''' list of blocked users? '''
return TemplateResponse(
request, 'preferences/blocks.html', {'title': 'Blocked Users'})
return TemplateResponse(request, 'preferences/blocks.html')
def post(self, request, user_id):
''' block a user '''

View file

@ -82,7 +82,6 @@ class Book(View):
)
data = {
'title': book.title,
'book': book,
'reviews': reviews_page,
'review_count': reviews.count(),
@ -113,7 +112,6 @@ class EditBook(View):
if not book.description:
book.description = book.parent_work.description
data = {
'title': 'Edit Book',
'book': book,
'form': forms.EditionForm(instance=book)
}
@ -126,7 +124,6 @@ class EditBook(View):
form = forms.EditionForm(request.POST, request.FILES, instance=book)
if not form.is_valid():
data = {
'title': 'Edit Book',
'book': book,
'form': form
}
@ -146,7 +143,6 @@ class Editions(View):
return ActivitypubResponse(work.to_edition_list(**request.GET))
data = {
'title': 'Editions of %s' % work.title,
'editions': work.editions.order_by('-edition_rank').all(),
'work': work,
}

View file

@ -3,11 +3,9 @@ from django.template.response import TemplateResponse
def server_error_page(request):
''' 500 errors '''
return TemplateResponse(
request, 'error.html', {'title': 'Oops!'}, status=500)
return TemplateResponse(request, 'error.html', status=500)
def not_found_page(request, _):
''' 404s '''
return TemplateResponse(
request, 'notfound.html', {'title': 'Not found'}, status=404)
return TemplateResponse(request, 'notfound.html', status=404)

View file

@ -17,8 +17,5 @@ class Federation(View):
def get(self, request):
''' edit form '''
servers = models.FederatedServer.objects.all()
data = {
'title': 'Federated Servers',
'servers': servers
}
data = {'servers': servers}
return TemplateResponse(request, 'settings/federation.html', data)

View file

@ -38,7 +38,6 @@ class Feed(View):
paginated = Paginator(activities, PAGE_LENGTH)
data = {**feed_page_data(request.user), **{
'title': 'Updates Feed',
'user': request.user,
'activities': paginated.page(page),
'tab': tab,
@ -75,7 +74,6 @@ class DirectMessage(View):
paginated = Paginator(activities, PAGE_LENGTH)
activity_page = paginated.page(page)
data = {**feed_page_data(request.user), **{
'title': 'Direct Messages',
'user': request.user,
'partner': user,
'activities': activity_page,
@ -108,7 +106,6 @@ class Status(View):
status.to_activity(pure=not is_bookwyrm_request(request)))
data = {**feed_page_data(request.user), **{
'title': 'Status by %s' % user.username,
'status': status,
}}
return TemplateResponse(request, 'feed/status.html', data)

View file

@ -30,7 +30,6 @@ class Goal(View):
return HttpResponseNotFound()
data = {
'title': '%s\'s %d Reading' % (user.display_name, year),
'goal_form': forms.GoalForm(instance=goal),
'goal': goal,
'user': user,
@ -53,7 +52,6 @@ class Goal(View):
form = forms.GoalForm(request.POST, instance=goal)
if not form.is_valid():
data = {
'title': '%s\'s %d Reading' % (request.user.display_name, year),
'goal_form': form,
'goal': goal,
'year': year,

View file

@ -19,7 +19,6 @@ class Import(View):
def get(self, request):
''' load import page '''
return TemplateResponse(request, 'import.html', {
'title': 'Import Books',
'import_form': forms.ImportForm(),
'jobs': models.ImportJob.
objects.filter(user=request.user).order_by('-created_date'),
@ -71,7 +70,6 @@ class ImportStatus(View):
failed_items = [i for i in items if i.fail_reason]
items = [i for i in items if not i.fail_reason]
return TemplateResponse(request, 'import_status.html', {
'title': 'Import Status',
'job': job,
'items': items,
'failed_items': failed_items,

View file

@ -30,7 +30,6 @@ class ManageInvites(View):
).order_by('-created_date'), PAGE_LENGTH)
data = {
'title': 'Invitations',
'invites': paginated.page(page),
'form': forms.CreateInviteForm(),
}
@ -50,7 +49,6 @@ class ManageInvites(View):
user=request.user
).order_by('-created_date'), PAGE_LENGTH)
data = {
'title': 'Invitations',
'invites': paginated.page(1),
'form': form
}
@ -66,7 +64,6 @@ class Invite(View):
invite = get_object_or_404(models.SiteInvite, code=code)
data = {
'title': 'Join',
'register_form': forms.RegisterForm(),
'invite': invite,
'valid': invite.valid() if invite else True,

View file

@ -12,10 +12,7 @@ class About(View):
''' create invites '''
def get(self, request):
''' more information about the instance '''
data = {
'title': 'About',
}
return TemplateResponse(request, 'discover/about.html', data)
return TemplateResponse(request, 'discover/about.html')
class Home(View):
''' discover page or home feed depending on auth '''
@ -43,7 +40,6 @@ class Discover(View):
).order_by('-review__published_date__max')[:6]
data = {
'title': 'Discover',
'register_form': forms.RegisterForm(),
'books': list(set(books)),
}

View file

@ -40,7 +40,6 @@ class Lists(View):
paginated = Paginator(lists, 12)
data = {
'title': 'Lists',
'lists': paginated.page(page),
'list_form': forms.ListForm(),
'path': '/list',
@ -72,7 +71,6 @@ class UserLists(View):
paginated = Paginator(lists, 12)
data = {
'title': '%s: Lists' % user.name,
'user': user,
'is_self': request.user.id == user.id,
'lists': paginated.page(page),
@ -114,7 +112,6 @@ class List(View):
data = {
'title': '%s | Lists' % book_list.name,
'list': book_list,
'items': book_list.listitem_set.filter(approved=True),
'pending_count': book_list.listitem_set.filter(
@ -149,7 +146,6 @@ class Curate(View):
return HttpResponseNotFound()
data = {
'title': 'Curate "%s" | Lists' % book_list.name,
'list': book_list,
'pending': book_list.listitem_set.filter(approved=False),
'list_form': forms.ListForm(instance=book_list),

View file

@ -16,7 +16,6 @@ class Notifications(View):
.order_by('-created_date')
unread = [n.id for n in notifications.filter(read=False)]
data = {
'title': 'Notifications',
'notifications': notifications,
'unread': unread,
}

View file

@ -19,7 +19,6 @@ class PasswordResetRequest(View):
return TemplateResponse(
request,
'password_reset_request.html',
{'title': 'Reset Password'}
)
def post(self, request):
@ -53,11 +52,7 @@ class PasswordReset(View):
except models.PasswordReset.DoesNotExist:
raise PermissionDenied
return TemplateResponse(
request,
'password_reset.html',
{'title': 'Reset Password', 'code': reset_code.code}
)
return TemplateResponse(request, 'password_reset.html')
def post(self, request, code):
''' allow a user to change their password through an emailed token '''
@ -90,10 +85,7 @@ class ChangePassword(View):
''' change password as logged in user '''
def get(self, request):
''' change password page '''
data = {
'title': 'Change Password',
'user': request.user,
}
data = {'user': request.user}
return TemplateResponse(
request, 'preferences/change_password.html', data)

View file

@ -58,7 +58,6 @@ class Search(View):
book_results = connector_manager.search(
query, min_confidence=min_confidence)
data = {
'title': 'Search Results',
'book_results': book_results,
'user_results': user_results,
'list_results': list_results,

View file

@ -53,7 +53,6 @@ class Shelf(View):
).order_by('-updated_date').all()
data = {
'title': '%s\'s %s shelf' % (user.display_name, shelf.name),
'user': user,
'is_self': is_self,
'shelves': shelves.all(),

View file

@ -19,10 +19,7 @@ class Site(View):
def get(self, request):
''' edit form '''
site = models.SiteSettings.objects.get()
data = {
'title': 'Site Settings',
'site_form': forms.SiteForm(instance=site)
}
data = {'site_form': forms.SiteForm(instance=site)}
return TemplateResponse(request, 'settings/site.html', data)
def post(self, request):
@ -30,10 +27,7 @@ class Site(View):
site = models.SiteSettings.objects.get()
form = forms.SiteForm(request.POST, instance=site)
if not form.is_valid():
data = {
'title': 'Site Settings',
'site_form': form
}
data = {'site_form': form}
return TemplateResponse(request, 'settings/site.html', data)
form.save()

View file

@ -25,7 +25,6 @@ class Tag(View):
usertag__tag__identifier=tag_id
).distinct()
data = {
'title': tag_obj.name,
'books': books,
'tag': tag_obj,
}

View file

@ -79,7 +79,6 @@ class User(View):
if not object_visible_to_user(request.user, goal):
goal = None
data = {
'title': user.name,
'user': user,
'is_self': is_self,
'shelves': shelf_preview,
@ -108,7 +107,6 @@ class Followers(View):
user.to_followers_activity(**request.GET))
data = {
'title': '%s: followers' % user.name,
'user': user,
'is_self': request.user.id == user.id,
'followers': user.followers.all(),
@ -133,7 +131,6 @@ class Following(View):
user.to_following_activity(**request.GET))
data = {
'title': '%s: following' % user.name,
'user': user,
'is_self': request.user.id == user.id,
'following': user.following.all(),
@ -147,7 +144,6 @@ class EditUser(View):
def get(self, request):
''' edit profile page for a user '''
data = {
'title': 'Edit profile',
'form': forms.EditUserForm(instance=request.user),
'user': request.user,
}

4
bw-dev
View file

@ -91,10 +91,10 @@ case "$CMD" in
execweb python manage.py collectstatic --no-input
;;
makemessages)
django-admin makemessages --extension html --ignore=venv3 $@
execweb django-admin makemessages --extension html --ignore=venv3 $@
;;
compilemessages)
django-admin compilemessages --ignore venv3 $@
execweb django-admin compilemessages --ignore venv3 $@
;;
build)
docker-compose build

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff