diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 1b14149f2..08661e9c2 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -24,5 +24,5 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint bookwyrm/ --ignore=migrations,tests --disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801 + pylint bookwyrm/ --ignore=migrations --disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801 diff --git a/README.md b/README.md index bd7344df9..1d3eb5433 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,10 @@ Social reading and reviewing, decentralized with ActivityPub - [What it is and isn't](#what-it-is-and-isnt) - [The role of federation](#the-role-of-federation) - [Features](#features) -- [Book data](#book-data) -- [Set up Bookwyrm](#set-up-bookwyrm) +- [Set up BookWyrm](#set-up-bookwyrm) ## Joining BookWyrm -BookWyrm is still a young piece of software, and isn't at the level of stability and feature-richness that you'd find in a production-ready application. But it does what it says on the box! If you'd like to join an instance, you can check out the [instances](https://joinbookwyrm.com/instances/) list. - -You can request an invite by entering your email address at https://bookwyrm.social. +If you'd like to join an instance, you can check out the [instances](https://joinbookwyrm.com/instances/) list. ## Contributing @@ -23,7 +20,7 @@ See [contributing](https://docs.joinbookwyrm.com/how-to-contribute.html) for cod ## About BookWyrm ### What it is and isn't -BookWyrm is a platform for social reading! You can use it to track what you're reading, review books, and follow your friends. It isn't primarily meant for cataloguing or as a data-source for books, but it does do both of those things to some degree. +BookWyrm is a platform for social reading. You can use it to track what you're reading, review books, and follow your friends. It isn't primarily meant for cataloguing or as a data-source for books, but it does do both of those things to some degree. ### The role of federation BookWyrm is built on [ActivityPub](http://activitypub.rocks/). With ActivityPub, it inter-operates with different instances of BookWyrm, and other ActivityPub compliant services, like Mastodon. This means you can run an instance for your book club, and still follow your friend who posts on a server devoted to 20th century Russian speculative fiction. It also means that your friend on mastodon can read and comment on a book review that you post on your BookWyrm instance. @@ -78,8 +75,5 @@ Deployment - [Nginx](https://nginx.org/en/) HTTP server -## Book data -The application is set up to share book and author data between instances, and get book data from arbitrary outside sources. Right now, the only connector is to OpenLibrary, but other connectors could be written. - -## Set up Bookwyrm -The [documentation website](https://docs.joinbookwyrm.com/) has instruction on how to set up Bookwyrm in a [developer environment](https://docs.joinbookwyrm.com/developer-environment.html) or [production](https://docs.joinbookwyrm.com/installing-in-production.html). +## Set up BookWyrm +The [documentation website](https://docs.joinbookwyrm.com/) has instruction on how to set up BookWyrm in a [developer environment](https://docs.joinbookwyrm.com/developer-environment.html) or [production](https://docs.joinbookwyrm.com/installing-in-production.html). diff --git a/bookwyrm/forms/books.py b/bookwyrm/forms/books.py index 72df1371c..9b3c84010 100644 --- a/bookwyrm/forms/books.py +++ b/bookwyrm/forms/books.py @@ -4,6 +4,7 @@ from django import forms from bookwyrm import models from bookwyrm.models.fields import ClearableFileInputWithWarning from .custom_form import CustomForm +from .widgets import ArrayWidget, SelectDateWidget, Select # pylint: disable=missing-class-docstring @@ -14,14 +15,6 @@ class CoverForm(CustomForm): help_texts = {f: None for f in fields} -class ArrayWidget(forms.widgets.TextInput): - # pylint: disable=unused-argument - # pylint: disable=no-self-use - def value_from_datadict(self, data, files, name): - """get all values for this name""" - return [i for i in data.getlist(name) if i] - - class EditionForm(CustomForm): class Meta: model = models.Edition @@ -56,16 +49,16 @@ class EditionForm(CustomForm): "publishers": forms.TextInput( attrs={"aria-describedby": "desc_publishers_help desc_publishers"} ), - "first_published_date": forms.SelectDateWidget( + "first_published_date": SelectDateWidget( attrs={"aria-describedby": "desc_first_published_date"} ), - "published_date": forms.SelectDateWidget( + "published_date": SelectDateWidget( attrs={"aria-describedby": "desc_published_date"} ), "cover": ClearableFileInputWithWarning( attrs={"aria-describedby": "desc_cover"} ), - "physical_format": forms.Select( + "physical_format": Select( attrs={"aria-describedby": "desc_physical_format"} ), "physical_format_detail": forms.TextInput( @@ -85,3 +78,27 @@ class EditionForm(CustomForm): ), "ASIN": forms.TextInput(attrs={"aria-describedby": "desc_ASIN"}), } + + +class EditionFromWorkForm(CustomForm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # make all fields hidden + for visible in self.visible_fields(): + visible.field.widget = forms.HiddenInput() + + class Meta: + model = models.Work + fields = [ + "title", + "subtitle", + "authors", + "description", + "languages", + "series", + "series_number", + "subjects", + "subject_places", + "cover", + "first_published_date", + ] diff --git a/bookwyrm/forms/forms.py b/bookwyrm/forms/forms.py index 8af8fb812..9d8f9f392 100644 --- a/bookwyrm/forms/forms.py +++ b/bookwyrm/forms/forms.py @@ -45,7 +45,7 @@ class ReportForm(CustomForm): class ReadThroughForm(CustomForm): def clean(self): - """make sure the email isn't in use by a registered user""" + """don't let readthroughs end before they start""" cleaned_data = super().clean() start_date = cleaned_data.get("start_date") finish_date = cleaned_data.get("finish_date") diff --git a/bookwyrm/forms/landing.py b/bookwyrm/forms/landing.py index 61b92ee83..b01c2cc98 100644 --- a/bookwyrm/forms/landing.py +++ b/bookwyrm/forms/landing.py @@ -42,4 +42,4 @@ class InviteRequestForm(CustomForm): class Meta: model = models.InviteRequest - fields = ["email"] + fields = ["email", "answer"] diff --git a/bookwyrm/forms/widgets.py b/bookwyrm/forms/widgets.py new file mode 100644 index 000000000..ee9345aa0 --- /dev/null +++ b/bookwyrm/forms/widgets.py @@ -0,0 +1,70 @@ +""" using django model forms """ +from django import forms + + +class ArrayWidget(forms.widgets.TextInput): + """Inputs for postgres array fields""" + + # pylint: disable=unused-argument + # pylint: disable=no-self-use + def value_from_datadict(self, data, files, name): + """get all values for this name""" + return [i for i in data.getlist(name) if i] + + +class Select(forms.Select): + """custom template for select widget""" + + template_name = "widgets/select.html" + + +class SelectDateWidget(forms.SelectDateWidget): + """ + A widget that splits date input into two {% trans "This is a new work" %} @@ -119,7 +125,7 @@ {% if not confirm_mode %}
- {% if book %} + {% if book.id %} {% trans "Cancel" %} {% else %} diff --git a/bookwyrm/templates/book/edit/edit_book_form.html b/bookwyrm/templates/book/edit/edit_book_form.html index 42f1840df..bf5404be5 100644 --- a/bookwyrm/templates/book/edit/edit_book_form.html +++ b/bookwyrm/templates/book/edit/edit_book_form.html @@ -10,6 +10,8 @@ {% csrf_token %} + +
@@ -153,8 +155,7 @@ - - + {{ form.first_published_date }} {% include 'snippets/form_errors.html' with errors_list=form.first_published_date.errors id="desc_first_published_date" %}
@@ -162,7 +163,7 @@ - + {{ form.published_date }} {% include 'snippets/form_errors.html' with errors_list=form.published_date.errors id="desc_published_date" %}
@@ -175,6 +176,8 @@
{% if book.authors.exists %} + {# preserve authors if the book is unsaved #} +
{% for author in book.authors.all %}
@@ -255,9 +258,7 @@ -
- {{ form.physical_format }} -
+ {{ form.physical_format }} {% include 'snippets/form_errors.html' with errors_list=form.physical_format.errors id="desc_physical_format" %}
diff --git a/bookwyrm/templates/book/editions/editions.html b/bookwyrm/templates/book/editions/editions.html index a3ff08022..e15e7a74d 100644 --- a/bookwyrm/templates/book/editions/editions.html +++ b/bookwyrm/templates/book/editions/editions.html @@ -46,7 +46,36 @@ {% endfor %}
-
+
{% include 'snippets/pagination.html' with page=editions path=request.path %}
+ +
+

+ {% trans "Can't find the edition you're looking for?" %} +

+ +
+ {% csrf_token %} + {{ work_form.title }} + {{ work_form.subtitle }} + {{ work_form.authors }} + {{ work_form.description }} + {{ work_form.languages }} + {{ work_form.series }} + {{ work_form.cover }} + {{ work_form.first_published_date }} + {% for subject in work.subjects %} + + {% endfor %} + + +
+ +
+
+
+ {% endblock %} diff --git a/bookwyrm/templates/components/tooltip.html b/bookwyrm/templates/components/tooltip.html deleted file mode 100644 index 3176a6399..000000000 --- a/bookwyrm/templates/components/tooltip.html +++ /dev/null @@ -1,11 +0,0 @@ -{% load i18n %} - -{% trans "Help" as button_text %} -{% include 'snippets/toggle/open_button.html' with text=button_text class="ml-3 is-rounded is-small has-background-body p-0 pb-1" icon="question-circle is-size-6" controls_text=controls_text controls_uid=controls_uid %} - - diff --git a/bookwyrm/templates/confirm_email/confirm_email.html b/bookwyrm/templates/confirm_email/confirm_email.html index 8c8adcdd9..abdd3a734 100644 --- a/bookwyrm/templates/confirm_email/confirm_email.html +++ b/bookwyrm/templates/confirm_email/confirm_email.html @@ -29,9 +29,16 @@
- {% trans "Can't find your code?" as button_text %} - {% include "snippets/toggle/open_button.html" with text=button_text controls_text="resend_form" focus="resend_form_header" %} - {% include "confirm_email/resend_form.html" with controls_text="resend_form" %} +
+ +
+ {% include "confirm_email/resend_modal.html" with id="resend_form" %}
diff --git a/bookwyrm/templates/confirm_email/resend.html b/bookwyrm/templates/confirm_email/resend.html new file mode 100644 index 000000000..221f07565 --- /dev/null +++ b/bookwyrm/templates/confirm_email/resend.html @@ -0,0 +1,10 @@ +{% extends 'landing/layout.html' %} +{% load i18n %} + +{% block title %} +{% trans "Resend confirmation link" %} +{% endblock %} + +{% block content %} +{% include "confirm_email/resend_modal.html" with active=True static=True id="resend-modal" %} +{% endblock %} diff --git a/bookwyrm/templates/confirm_email/resend_form.html b/bookwyrm/templates/confirm_email/resend_form.html deleted file mode 100644 index 7c0c10980..000000000 --- a/bookwyrm/templates/confirm_email/resend_form.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "components/inline_form.html" %} -{% load i18n %} -{% block header %} -{% trans "Resend confirmation link" %} -{% endblock %} - -{% block form %} -
- {% csrf_token %} -
- -
- -
-
-
- -
-
-{% endblock %} diff --git a/bookwyrm/templates/confirm_email/resend_modal.html b/bookwyrm/templates/confirm_email/resend_modal.html new file mode 100644 index 000000000..beb9318a9 --- /dev/null +++ b/bookwyrm/templates/confirm_email/resend_modal.html @@ -0,0 +1,44 @@ +{% extends "components/modal.html" %} +{% load i18n %} + +{% block modal-title %} +{% trans "Resend confirmation link" %} +{% endblock %} + +{% block modal-form-open %} +
+{% endblock %} + +{% block modal-body %} +{% csrf_token %} +
+ +
+ + {% if error %} +
+

+ {% trans "No user matching this email address found." %} +

+
+ {% endif %} +
+
+{% endblock %} + +{% block modal-footer %} +
+ +
+{% endblock %} + +{% block modal-form-close %} +
+{% endblock %} diff --git a/bookwyrm/templates/embed-layout.html b/bookwyrm/templates/embed-layout.html index e0234494c..233ba387f 100644 --- a/bookwyrm/templates/embed-layout.html +++ b/bookwyrm/templates/embed-layout.html @@ -43,7 +43,7 @@ {% endif %}

- {% trans "Join Bookwyrm" %} + {% trans "Join BookWyrm" %}

diff --git a/bookwyrm/templates/feed/suggested_books.html b/bookwyrm/templates/feed/suggested_books.html index 2582dcf06..12e478201 100644 --- a/bookwyrm/templates/feed/suggested_books.html +++ b/bookwyrm/templates/feed/suggested_books.html @@ -5,7 +5,19 @@

{% trans "Your Books" %}

{% if not suggested_books %} -

{% trans "There are no books here right now! Try searching for a book to get started" %}

+ +
+

{% trans "There are no books here right now! Try searching for a book to get started" %}

+ + +
+ {% else %} {% with active_book=request.GET.book %}
diff --git a/bookwyrm/templates/import/import.html b/bookwyrm/templates/import/import.html index fdeb0e55b..6df7c0843 100644 --- a/bookwyrm/templates/import/import.html +++ b/bookwyrm/templates/import/import.html @@ -14,28 +14,32 @@
-
-
- -
{{ import_form.csv_file }} @@ -63,7 +67,7 @@

{% trans "Recent Imports" %}

{% if not jobs %} -

{% trans "No recent imports" %}

+

{% trans "No recent imports" %}

{% endif %}
    {% for job in jobs %} diff --git a/bookwyrm/templates/import/tooltip.html b/bookwyrm/templates/import/tooltip.html deleted file mode 100644 index f2712b7e9..000000000 --- a/bookwyrm/templates/import/tooltip.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'components/tooltip.html' %} -{% load i18n %} - -{% block tooltip_content %} - -{% trans 'You can download your Goodreads data from the Import/Export page of your Goodreads account.' %} - -{% endblock %} diff --git a/bookwyrm/templates/landing/layout.html b/bookwyrm/templates/landing/layout.html index 6d69cafc2..bf0a6b2a1 100644 --- a/bookwyrm/templates/landing/layout.html +++ b/bookwyrm/templates/landing/layout.html @@ -70,6 +70,14 @@ {% include 'snippets/form_errors.html' with errors_list=request_form.email.errors id="desc_request_email" %}
+ {% if site.invite_request_question %} +
+ + + {% include 'snippets/form_errors.html' with errors_list=request_form.answer.errors id="desc_answer_register" %} +
+ {% endif %} + {% endif %} diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index dadf42ab5..6b9e4daa1 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -90,64 +90,8 @@