diff --git a/.github/workflows/curlylint.yaml b/.github/workflows/curlylint.yaml new file mode 100644 index 000000000..e27d0b1b3 --- /dev/null +++ b/.github/workflows/curlylint.yaml @@ -0,0 +1,28 @@ +name: Templates validator + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install curlylint + run: pip install curlylint + + - name: Run linter + run: > + curlylint --rule 'aria_role: true' \ + --rule 'django_forms_rendering: true' \ + --rule 'html_has_lang: true' \ + --rule 'image_alt: true' \ + --rule 'meta_viewport: true' \ + --rule 'no_autofocus: true' \ + --rule 'tabindex_no_positive: true' \ + --exclude '_modal.html|create_status/layout.html' \ + bookwyrm/templates diff --git a/bookwyrm/templates/author/author.html b/bookwyrm/templates/author/author.html index 1c409d062..77c7b901d 100644 --- a/bookwyrm/templates/author/author.html +++ b/bookwyrm/templates/author/author.html @@ -57,7 +57,7 @@ {% if author.wikipedia_link %}

- + {% trans "Wikipedia" %}

diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 28655fa6b..e504041bb 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -134,7 +134,7 @@
{% csrf_token %}

- +

diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index ee6cdcade..2f6ca3242 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -42,11 +42,18 @@
{% endif %} -{% if book %} - -{% else %} - -{% endif %} + {% csrf_token %} {% if confirm_mode %} diff --git a/bookwyrm/templates/book/readthrough.html b/bookwyrm/templates/book/readthrough.html index 05ed3c639..12430f75b 100644 --- a/bookwyrm/templates/book/readthrough.html +++ b/bookwyrm/templates/book/readthrough.html @@ -6,7 +6,6 @@
{% trans "Progress Updates:" %} -
    {% if readthrough.finish_date or readthrough.progress %}
  • diff --git a/bookwyrm/templates/email/preview.html b/bookwyrm/templates/email/preview.html index 66d856c08..ab4323054 100644 --- a/bookwyrm/templates/email/preview.html +++ b/bookwyrm/templates/email/preview.html @@ -1,4 +1,4 @@ - +
    Subject: {% include subject_path %} diff --git a/bookwyrm/templates/feed/feed.html b/bookwyrm/templates/feed/feed.html index 39eebb26d..265a467a7 100644 --- a/bookwyrm/templates/feed/feed.html +++ b/bookwyrm/templates/feed/feed.html @@ -40,11 +40,10 @@ {% if suggested_users %} {# suggested users for when things are very lonely #} {% include 'feed/suggested_users.html' with suggested_users=suggested_users %} + {% endif %}
    {% endif %} -{% endif %} - {% for activity in activities %} {% if not activities.number > 1 and forloop.counter0 == 2 and suggested_users %} diff --git a/bookwyrm/templates/feed/suggested_users.html b/bookwyrm/templates/feed/suggested_users.html index c095faa55..1de1ae139 100644 --- a/bookwyrm/templates/feed/suggested_users.html +++ b/bookwyrm/templates/feed/suggested_users.html @@ -2,5 +2,5 @@

    {% trans "Who to follow" %}

    {% include 'snippets/suggested_users.html' with suggested_users=suggested_users %} - View directory + {% trans "View directory" %}
    diff --git a/bookwyrm/templates/import_status.html b/bookwyrm/templates/import_status.html index 19dcb4314..db7330bb2 100644 --- a/bookwyrm/templates/import_status.html +++ b/bookwyrm/templates/import_status.html @@ -20,10 +20,10 @@
    {% trans "Import completed:" %}
    {{ task.date_done | naturaltime }}
+ {% elif task.failed %} +
{% trans "TASK FAILED" %}
+ {% endif %} - {% elif task.failed %} -
{% trans "TASK FAILED" %}
- {% endif %}
@@ -84,26 +84,26 @@ - -
- - {% else %} - - {% endif %} + +
+ + {% else %} + + {% endif %}
{% endif %} @@ -153,7 +153,6 @@ {% endfor %} - {% endspaceless %}{% endblock %} {% block scripts %} diff --git a/bookwyrm/templates/isbn_search_results.html b/bookwyrm/templates/isbn_search_results.html deleted file mode 100644 index a3861a68a..000000000 --- a/bookwyrm/templates/isbn_search_results.html +++ /dev/null @@ -1,33 +0,0 @@ -{% extends 'layout.html' %} -{% load i18n %} - -{% block title %}{% trans "Search Results" %}{% endblock %} - -{% block content %} -{% with book_results|first as local_results %} -
-

{% blocktrans %}Search Results for "{{ query }}"{% endblocktrans %}

-
- -
-
-

{% trans "Matching Books" %}

-
- {% if not results %} -

{% blocktrans %}No books found for "{{ query }}"{% endblocktrans %}

- {% else %} - - {% endif %} -
- -
-
-
-{% endwith %} -{% endblock %} diff --git a/bookwyrm/templates/settings/announcements.html b/bookwyrm/templates/settings/announcements.html index a0b363e63..18e765317 100644 --- a/bookwyrm/templates/settings/announcements.html +++ b/bookwyrm/templates/settings/announcements.html @@ -7,7 +7,6 @@ {% block edit-button %} {% trans "Create Announcement" as button_text %} {% include 'snippets/toggle/open_button.html' with controls_text="create_announcement" icon_with_text="plus" text=button_text focus="create_announcement_header" %} - {% endblock %} {% block panel %} diff --git a/bookwyrm/templates/settings/manage_invites.html b/bookwyrm/templates/settings/manage_invites.html index 5b075114e..6efaefcf2 100644 --- a/bookwyrm/templates/settings/manage_invites.html +++ b/bookwyrm/templates/settings/manage_invites.html @@ -54,7 +54,7 @@ {% endif %} {% for invite in invites %} - {{ invite.link }} + {{ invite.link }} {{ invite.expiry|naturaltime }} {{ invite.use_limit }} {{ invite.times_used }} diff --git a/bookwyrm/templates/settings/server_blocklist.html b/bookwyrm/templates/settings/server_blocklist.html index 171cf1339..49334982f 100644 --- a/bookwyrm/templates/settings/server_blocklist.html +++ b/bookwyrm/templates/settings/server_blocklist.html @@ -47,7 +47,7 @@