From 2921e754edb4f9adc2e6957f10323f1d99e64613 Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Fri, 5 Jan 2024 23:02:32 +0200 Subject: [PATCH] Lint html templates --- pyproject.toml | 18 +++ templates/404.html | 34 +++-- templates/500.html | 39 +++--- templates/base_admin_dashboard.html | 46 +++--- templates/categories/category_list.html | 3 +- templates/categories/categoryimage_list.html | 25 ++-- templates/dashblocks/dashblock_form.html | 2 +- templates/dashblocks/dashblock_list.html | 4 +- templates/email_base.html | 13 +- templates/frame.html | 14 +- templates/jobs/jobsource_create.html | 3 +- .../landingpages/landingpage_create.html | 53 ++++--- templates/orgs/org_edit.html | 2 +- templates/orgs/org_home.html | 60 ++++---- templates/orgs/org_manage_accounts.html | 6 +- templates/polls/poll_create.html | 62 +++++---- templates/polls/poll_images.html | 6 +- templates/polls/poll_list.html | 2 +- templates/polls/poll_questions.html | 25 ++-- templates/polls/poll_responses.html | 24 ++-- templates/public/about.html | 9 +- templates/public/edit_content.html | 2 +- templates/public/featured_region.html | 1 + templates/public/icons.html | 6 +- templates/public/index.html | 18 +-- templates/public/join_engage.html | 2 +- templates/public/landing_page.html | 4 +- templates/public/mobile_age_include.html | 4 +- templates/public/mobile_gender_include.html | 5 +- templates/public/org_chooser.html | 96 ++++++------- templates/public/org_flags.html | 4 +- templates/public/polls.html | 22 +-- templates/public/reports.html | 12 +- templates/public/stories.html | 28 ++-- templates/public/story_read.html | 11 +- templates/public/strings_values.html | 1 + templates/public/ureporters.html | 30 ++-- templates/public_base.html | 23 +-- templates/rest_framework/base.html | 101 +++++--------- templates/rest_framework_swagger/index.html | 17 ++- templates/smartmin/base.html | 131 +++++++++--------- templates/smartmin/delete_confirm.html | 41 +++--- templates/smartmin/field.html | 1 + templates/smartmin/form.html | 36 +++-- templates/smartmin/list.html | 51 +++---- templates/smartmin/read.html | 4 +- templates/smartmin/users/user_failed.html | 1 + templates/smartmin/users/user_forget.html | 5 +- templates/smartmin/users/user_list.html | 11 +- .../smartmin/users/user_newpassword.html | 1 + templates/smartmin/users/user_update.html | 1 + templates/stories/story_create.html | 24 ++-- templates/stories/story_list.html | 7 +- templates/stories/story_update.html | 24 ++-- 54 files changed, 567 insertions(+), 608 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 27917aebf..07ce21d43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,24 @@ combine_as_imports = true sections = ["FUTURE", "STDLIB", "THIRDPARTY", "DJANGO", "FIRSTPARTY", "LOCALFOLDER"] known_django = ["django"] +[tool.djlint] +blank_line_after_tag = "load" +custom_blocks = "render" +format_css = true +format_js = true +ignore = "H006,H019,H021,H023" +indent = 2 +max_attribute_length = 100 +max_line_length = 200 + +[tool.djlint.css] +indent_size = 2 + +[tool.djlint.js] +indent_size = 2 +templating = "django" + + [tool.coverage.run] source = ["ureport"] diff --git a/templates/404.html b/templates/404.html index 632a60384..2e0a3f14f 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,31 +1,35 @@ - + + + + + U-Report - Not Found.
Sorry, that page wasn't found. diff --git a/templates/500.html b/templates/500.html index aba3bbddd..fec276a49 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,50 +1,51 @@ - + + + + + U-Report Problem - Uh oh!

Sometimes bad things happen to good people.

@@ -56,7 +57,7 @@

Sometimes bad things happen to good people.


{% if request.sentry.id %} -
+
If you'd like to contact us about this error, please be sure to include your reference number {{ request.sentry.id }}
diff --git a/templates/base_admin_dashboard.html b/templates/base_admin_dashboard.html index f7530a6b0..92559c816 100644 --- a/templates/base_admin_dashboard.html +++ b/templates/base_admin_dashboard.html @@ -72,7 +72,7 @@
{% if is_rtl_org %}
{% endif %}
-
- + {% trans "Opinions" %} @@ -153,7 +153,7 @@
  • - + {% trans "Stories" %} @@ -161,7 +161,7 @@
  • - + {% trans "Bots" %} @@ -169,7 +169,7 @@
  • - + {% trans "Users" %} @@ -177,7 +177,7 @@
  • - + {% trans "Settings" %} @@ -185,14 +185,14 @@
  • - + {% trans "Pages" %}
  • - + {% trans "Landing Pages" %} @@ -201,7 +201,7 @@
  • - + {% trans "Jobs" %} @@ -209,7 +209,7 @@
  • - + {% trans "Categories" %} @@ -217,7 +217,7 @@
  • - + {% trans "Tags" %} @@ -225,7 +225,7 @@
  • - + {% trans "Partners Logos" %} @@ -234,7 +234,7 @@
  • - + {% trans "Categories Images" %} @@ -244,7 +244,7 @@
  • - + {% trans "News Items" %} @@ -254,15 +254,15 @@
  • - + {% trans "Orgs" %}
  • - + - + {% trans "Users" %} @@ -270,7 +270,7 @@
  • - + {% trans "Content Types" %} @@ -278,7 +278,7 @@
  • - + {% trans "Images" %} @@ -326,10 +326,10 @@
    {% if org.language != "ar" and org.language != "ru" %} + class="md:-ml-0 -ml-2" alt=""> {% else %} + class="md:-ml-0 -ml-2" alt=""> {% endif %}
    {% endif %} @@ -346,10 +346,10 @@
    {% if org.language != "ar" and org.language != "ru" %} + class="-ml-2" alt=""> {% else %} + class="-ml-2" alt=""> {% endif %}
    {% endif %} diff --git a/templates/categories/category_list.html b/templates/categories/category_list.html index 3f7914349..650ed5680 100644 --- a/templates/categories/category_list.html +++ b/templates/categories/category_list.html @@ -1,8 +1,9 @@ {% extends "smartmin/list.html" %} {% load thumbnail smartmin i18n %} + {% block content-title %}

    - +
    {% trans "Categories" %}

    {% endblock content-title %} diff --git a/templates/categories/categoryimage_list.html b/templates/categories/categoryimage_list.html index 63d1d4a44..ae6c3068b 100644 --- a/templates/categories/categoryimage_list.html +++ b/templates/categories/categoryimage_list.html @@ -1,8 +1,9 @@ {% extends "smartmin/list.html" %} {% load thumbnail smartmin i18n %} + {% block content-title %}

    - +
    {% trans "Category Images" %}

    {% endblock content-title %} @@ -17,9 +18,9 @@

    {% get_value obj field %}
    {% thumbnail obj.image "640x360" crop="top" as im %} - + {% empty %} - + {% endthumbnail %}
    @@ -33,14 +34,14 @@

    {% block extra-style %} {{ block.super }} {% endblock extra-style %} diff --git a/templates/dashblocks/dashblock_form.html b/templates/dashblocks/dashblock_form.html index 944f36b2b..1ce97387f 100644 --- a/templates/dashblocks/dashblock_form.html +++ b/templates/dashblocks/dashblock_form.html @@ -11,7 +11,7 @@ + height="{{ img.y }}" alt=""/> {% endthumbnail %} {% if filtered_type %} - + icon {% else %} - + icon {% endif %}
    {% if filtered_type %} diff --git a/templates/email_base.html b/templates/email_base.html index 239330187..176aeadbe 100644 --- a/templates/email_base.html +++ b/templates/email_base.html @@ -1,6 +1,8 @@ - + + + {{ subject }} @@ -29,11 +31,7 @@ - +
    - +
    {{ subject }} - {% block body %}{% endblock %} + {% block body %} + {% endblock body %}

    diff --git a/templates/frame.html b/templates/frame.html index 610de81f9..298da6eb4 100644 --- a/templates/frame.html +++ b/templates/frame.html @@ -143,9 +143,9 @@ @@ -177,7 +177,7 @@ {% trans "Orgs" %}
  • - {% trans "Users" %} + {% trans "Users" %}
  • {% trans "Content Types" %} @@ -405,7 +405,7 @@
    {% thumbnail story.get_image "450x240" crop="top" as im %} - + {% endthumbnail %}
    {{ story.title }}
    @@ -422,7 +422,7 @@
    - +
  • {{ invite.email }} (Invite Sent on {{ invite.modified_on }}){{ invite.email }} (Invite Sent on {{ invite.modified_on }}) {% if invite.user_group == 'A' %} diff --git a/templates/polls/poll_create.html b/templates/polls/poll_create.html index 88579e953..545f84c99 100644 --- a/templates/polls/poll_create.html +++ b/templates/polls/poll_create.html @@ -1,55 +1,57 @@ {% extends "smartmin/update.html" %} {% block extra-style %} - + {% endblock extra-style %} {% block extra-script %} - + {% endblock extra-script %} diff --git a/templates/polls/poll_images.html b/templates/polls/poll_images.html index 9f0288337..a42c91b27 100644 --- a/templates/polls/poll_images.html +++ b/templates/polls/poll_images.html @@ -1,14 +1,14 @@ {% extends 'smartmin/form.html' %} {% block extra-style %} - + {% endblock extra-style %} diff --git a/templates/polls/poll_list.html b/templates/polls/poll_list.html index eded757ee..57478f3bb 100644 --- a/templates/polls/poll_list.html +++ b/templates/polls/poll_list.html @@ -2,7 +2,7 @@ {% load i18n smartmin %} {% block content-title %}

    - +
    {% trans "Opinions" %}

    {% endblock content-title %} diff --git a/templates/polls/poll_questions.html b/templates/polls/poll_questions.html index 642e58f5e..76f394835 100644 --- a/templates/polls/poll_questions.html +++ b/templates/polls/poll_questions.html @@ -1,5 +1,6 @@ {% extends "smartmin/update.html" %} {% load smartmin i18n %} + {% block fields %}
    {% for field in fields %} @@ -23,17 +24,17 @@ {% endblock post-form %} {% block extra-style %} {% endblock extra-style %} diff --git a/templates/polls/poll_responses.html b/templates/polls/poll_responses.html index f4297cd8a..ddd9eba18 100644 --- a/templates/polls/poll_responses.html +++ b/templates/polls/poll_responses.html @@ -1,28 +1,24 @@ {% extends "smartmin/update.html" %} {% block extra-style %} - - - + {% endblock extra-style %} {% block extra-script %} - - - + + + {% endblock extra-script %} diff --git a/templates/public/about.html b/templates/public/about.html index 542b360fb..28bf8d9fc 100644 --- a/templates/public/about.html +++ b/templates/public/about.html @@ -1,5 +1,6 @@ {% extends "public_base.html" %} {% load dashblocks thumbnail i18n ureport %} + {% block content %} {% load_qbs request.org 'about' %}
    @@ -18,11 +19,9 @@
    {% edit_content 'dashblocks.dashblock_update' d_block.pk "#id_image" "-m-8" "dark" %} {% thumbnail d_block.image "800x600" crop="top" as im %} - + {% empty %} - + {% endthumbnail %}
    @@ -39,7 +38,7 @@
    {% thumbnail partner_logo.image "x500" crop="center" as im %} - + {% endthumbnail %}
    diff --git a/templates/public/edit_content.html b/templates/public/edit_content.html index 0470fc5e7..2b3ecac3a 100644 --- a/templates/public/edit_content.html +++ b/templates/public/edit_content.html @@ -6,7 +6,7 @@ rel="noopener noreferrer" class="text-3xl">
    - +
    diff --git a/templates/public/featured_region.html b/templates/public/featured_region.html index f55887403..46d46bd8e 100644 --- a/templates/public/featured_region.html +++ b/templates/public/featured_region.html @@ -1,4 +1,5 @@ {% load ureport %} +
    - + {% endfor %} diff --git a/templates/public/index.html b/templates/public/index.html index 93347fde3..27a620bd3 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -8,7 +8,7 @@
    {% trans "LATEST OPINION" %}
    - {% edit_content 'polls.poll_update' latest_poll.pk "#id_title" "-m-8" "dark" %} + {% edit_content 'polls.poll_update' latest_poll.pk "#id_title" "-m-8" "dark" %} {{ latest_poll.title }}
    @@ -148,7 +148,7 @@
    - {% edit_content 'orgs.org_edit' "" "#id_common.join_text" "-m-8" "dark" %} + {% edit_content "orgs.org_edit" "" "#id_common.join_text" "-m-8" "dark" %}
    {% if org|config:"join_text" %} {{ org|config:"join_text" }} @@ -168,7 +168,7 @@
    - {% edit_content 'orgs.org_edit' "" "#id_common.homepage_join_video_id" "-m-8" "white" %} + {% edit_content "orgs.org_edit" "" "#id_common.homepage_join_video_id" "-m-8" "white" %} {% if org|config:"homepage_join_video_id" %}