Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
Re-enable djlint precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
albertkol committed Jun 11, 2024
1 parent 0682cc4 commit 85e08e4
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 136 deletions.
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-jmespath, types-requests, types-beautifulsoup4, types-flask, types-python-dateutil]
# - repo: https://github.com/Riverside-Healthcare/djLint
# rev: v1.24.0
# hooks:
# - id: djlint-jinja
# types_or: ['html', 'jinja']
# TODO: turn this back on and fix issues
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1
hooks:
- id: djlint-jinja
types_or: ['html', 'jinja']
28 changes: 13 additions & 15 deletions app/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{% extends 'govuk_frontend_jinja/template.html' %}
{% extends "govuk_frontend_jinja/template.html" %}

{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}
{%- from 'govuk_frontend_jinja/components/error-summary/macro.html' import govukErrorSummary-%}
{%- from 'govuk_frontend_jinja/components/error-summary/macro.html' import govukErrorSummary -%}
{%- from 'govuk_frontend_jinja/components/notification-banner/macro.html' import govukNotificationBanner -%}
{%- from 'govuk_frontend_jinja/components/phase-banner/macro.html' import govukPhaseBanner -%}
{%- from 'govuk_frontend_jinja/components/header/macro.html' import govukHeader -%}

{% set assetPath = url_for('static', filename='').rstrip('/') %}

{% block pageTitle %}{{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}{{ config['SERVICE_NAME'] }} – GOV.UK{% endblock pageTitle %}

{% block head %}
<meta name="description" content="{{config['SERVICE_NAME']}}">
<meta name="description" content="{{ config['SERVICE_NAME'] }}">
<meta name="keywords" content="GOV.UK, govuk, gov, government, uk, frontend, ui, user interface, jinja, python, flask, port, template, templating, macro, component, design system, html, forms, wtf, wtforms, widget, widgets, demo, example">
<meta name="author" content="{{config['DEPARTMENT_NAME']}}">
<meta name="author" content="{{ config['DEPARTMENT_NAME'] }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='govuk-frontend/govuk-frontend-4.6.0.min.css') }}" />
<link rel="shortcut icon" href="{{ url_for('static', filename='govuk-frontend/images/favicon.ico') }}">
{% assets "css" %}<link href="{{ ASSET_URL }}" rel="stylesheet">{% endassets %}
{% endblock %}
{% endblock head %}

{% block header %}
{{ govukHeader({
'homepageUrl': url_for('main.download'),
'serviceUrl': url_for('main.download'),
'serviceName': config['SERVICE_NAME'],
}) }}
{% endblock %}
{% endblock header %}

{% block beforeContent %}
{% block phaseBanner %}
Expand All @@ -35,12 +35,10 @@
},
'html': 'This is a new service – your <a class="govuk-link" href="mailto:' + config['CONTACT_EMAIL'] +'?subject=Feedback">feedback</a> will help us to improve it.'
}) }}
{% endblock %}
{% endblock phaseBanner %}

<div class="global-actions">
{% if request.path in [url_for('main.download'), url_for('main.start_page')] %}
<div></div>
{% else %}
{% if request.path not in [url_for('main.download'), url_for('main.start_page')] %}
{{ govukBackLink({
'text': 'Back',
'href': url_for('main.download')
Expand All @@ -52,7 +50,7 @@
<a href="{{ config['AUTHENTICATOR_HOST'] + '/sso/logout' }}" class="govuk-body govuk-link govuk-link--no-underline govuk-link--no-visited-state govuk-!-margin-left-4">Log out</a>
</div>
</div>
{% endblock %}
{% endblock beforeContent %}

{% block content %}
{% if form and form.errors %}
Expand All @@ -66,7 +64,7 @@
{% endfor %}
{% endif %}
{% endwith %}
{% endblock %}
{% endblock content %}

{% block footer %}
<footer class="govuk-footer " role="contentinfo">
Expand Down Expand Up @@ -96,12 +94,12 @@ <h2 class="govuk-visually-hidden">Support links</h2>
</div>
</footer>

{% endblock %}
{% endblock content %}

{% block bodyEnd %}
<!--[if gt IE 8]><!-->
<script src="{{ url_for('static', filename='govuk-frontend/govuk-frontend-4.6.0.min.js') }}"> </script>
<script>window.GOVUKFrontend.initAll()</script>
<!--<![endif]-->
{% assets "js" %}<script type="text/javascript" src="{{ ASSET_URL }}"></script>{% endassets %}
{% endblock %}
{% endblock bodyEnd %}
8 changes: 3 additions & 5 deletions app/templates/main/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}


{% block pageTitle %}Page not found – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}Page not found – {{ config['SERVICE_NAME'] }} – GOV.UK{% endblock pageTitle %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand All @@ -12,15 +11,14 @@
'text': "Back",
'href': url_for('main.download')
}) }}
{% endblock %}
{% endblock beforeContent %}

{% block content %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Page not found</h1>
<p class="govuk-body">If you typed the web address, check it is correct.</p>
<p class="govuk-body">If you pasted the web address, check you copied the entire address.</p>
</div>
</div>
{% endblock %}
{% endblock content %}
9 changes: 5 additions & 4 deletions app/templates/main/429.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}


{% block pageTitle %}Too many requests – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}
Too many requests – {{ config['SERVICE_NAME'] }} – GOV.UK
{% endblock pageTitle %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand All @@ -12,7 +13,7 @@
'text': "Back",
'href': url_for('main.download')
}) }}
{% endblock %}
{% endblock beforeContent %}

{% block content %}
<div class="govuk-grid-row">
Expand All @@ -22,4 +23,4 @@ <h1 class="govuk-heading-l">Sorry, there is a problem</h1>
<p class="govuk-body">Try again later.</p>
</div>
</div>
{% endblock %}
{% endblock content %}
9 changes: 5 additions & 4 deletions app/templates/main/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}


{% block pageTitle %}Sorry, there is a problem with the service – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}
Sorry, there is a problem with the service – {{ config['SERVICE_NAME'] }} – GOV.UK
{% endblock pageTitle %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand All @@ -12,7 +13,7 @@
'text': "Back",
'href': url_for('main.download')
}) }}
{% endblock %}
{% endblock beforeContent %}

{% block content %}
<div class="govuk-grid-row">
Expand All @@ -21,4 +22,4 @@ <h1 class="govuk-heading-l">Sorry, there is a problem with the service</h1>
<p class="govuk-body">Try again later.</p>
</div>
</div>
{% endblock %}
{% endblock content %}
7 changes: 3 additions & 4 deletions app/templates/main/503.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}


{% block pageTitle %}Sorry, the service is unavailable – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}Sorry, the service is unavailable – {{ config['SERVICE_NAME'] }} – GOV.UK{% endblock pageTitle %}

{% set mainClasses = "govuk-main-wrapper--l" %}

Expand All @@ -12,7 +11,7 @@
'text': "Back",
'href': url_for('main.download')
}) }}
{% endblock %}
{% endblock beforeContent %}

{% block content %}
<div class="govuk-grid-row">
Expand All @@ -21,4 +20,4 @@ <h1 class="govuk-heading-l">Sorry, the service is unavailable</h1>
<p class="govuk-body">You will be able to use the service from 9am on Monday 19&nbsp;November&nbsp;2018.</p>
</div>
</div>
{% endblock %}
{% endblock content %}
24 changes: 13 additions & 11 deletions app/templates/main/accessibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}
{%- from 'govuk_frontend_jinja/components/inset-text/macro.html' import govukInsetText -%}

{% block pageTitle %}Accessibility statement – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}
Accessibility statement – {{ config['SERVICE_NAME'] }} – GOV.UK
{% endblock pageTitle %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{{ super() }}
<h1 class="govuk-heading-xl">Accessibility statement for {{config['SERVICE_NAME']}}</h1>
<h1 class="govuk-heading-xl">Accessibility statement for {{ config['SERVICE_NAME'] }}</h1>

{{ govukInsetText({
'text': "Note: start with a brief explanation of which websites or mobile apps the statement covers.

You can have a single accessibility statement that covers multiple domains, or a separate statement for each domain or subdomain. As long as the user can access relevant accessibility information easily from any page on your website."
}) }}

<p class="govuk-body">This accessibility statement applies to {{config['SERVICE_URL']}}.</p>
<p class="govuk-body">This accessibility statement applies to {{ config['SERVICE_URL'] }}.</p>

{{ govukInsetText({
'text': "Note: use this section to make a brief, general statement about what the website allows disabled users to do. Base it on the evaluation covered in detail in the ‘Technical information about this website’s accessibility’ section. If you’re not confident that something is accurate, leave it out. If you’re not confident enough to say anything specific here, leave this section out completely."
}) }}

<p class="govuk-body">This website is run by {{config['DEPARTMENT_NAME']}}. We want as many people as possible to be able
<p class="govuk-body">This website is run by {{ config['DEPARTMENT_NAME'] }}. We want as many people as possible to be able
to use this website. For example, that means you should be able to:</p>
<ul class="govuk-list govuk-list--bullet">
<li>change colours, contrast levels and fonts</li>
Expand Down Expand Up @@ -58,8 +60,8 @@ <h3 class="govuk-heading-m">Feedback and contact information</h3>
<p class="govuk-body">If you need information on this website in a different format like accessible PDF, large
print, easy read, audio recording or braille:</p>
<ul class="govuk-list govuk-list--bullet">
<li>email {{config['CONTACT_EMAIL']}}</li>
<li>call {{config['CONTACT_PHONE']}}</li>
<li>email {{ config['CONTACT_EMAIL'] }}</li>
<li>call {{ config['CONTACT_PHONE'] }}</li>
<li>[add any other contact details]</li>
</ul>
<p class="govuk-body">We’ll consider your request and get back to you in [number] days.</p>
Expand Down Expand Up @@ -99,7 +101,7 @@ <h2 class="govuk-heading-l">Technical information about this website’s accessi
'text': "Note: this form of wording is legally required, so do not change it."
}) }}

<p class="govuk-body">{{config['DEPARTMENT_NAME']}} is committed to making its website accessible, in accordance with the
<p class="govuk-body">{{ config['DEPARTMENT_NAME'] }} is committed to making its website accessible, in accordance with the
Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018.</p>

<h3 class="govuk-heading-m">Compliance status</h3>
Expand Down Expand Up @@ -187,7 +189,7 @@ <h3 class="govuk-heading-s">Interactive tools and transactions</h3>
website.</p>

<p class="govuk-body">We’ve assessed the cost of fixing the issues with navigation and accessing information, and
with interactive tools and transactions. We believe that doing so now would be a <a href="http://www.legislation.gov.uk/uksi/2018/952/regulation/7/made" class="govuk-link">disproportionate burden</a> within
with interactive tools and transactions. We believe that doing so now would be a <a href="https://www.legislation.gov.uk/uksi/2018/952/regulation/7/made" class="govuk-link">disproportionate burden</a> within
the meaning of the accessibility regulations. We will make another assessment when the supplier contract is up for
renewal, likely to be in [rough timing].</p>

Expand All @@ -203,15 +205,15 @@ <h3 class="govuk-heading-s">PDFs and other documents</h3>
have PDFs with information on how users can access our services, and forms published as Word documents. By
September 2020, we plan to either fix these or replace them with accessible HTML pages.</p>

<p class="govuk-body">The accessibility regulations <a href="http://www.legislation.gov.uk/uksi/2018/952/regulation/4/made" class="govuk-link">do not require us to fix PDFs or other documents published
<p class="govuk-body">The accessibility regulations <a href="https://www.legislation.gov.uk/uksi/2018/952/regulation/4/made" class="govuk-link">do not require us to fix PDFs or other documents published
before 23 September 2018</a> if they’re not essential to providing our services. For example, we do not plan to fix
[example of non-essential document].</p>

<p class="govuk-body">Any new PDFs or Word documents we publish will meet accessibility standards.</p>

<h3 class="govuk-heading-s">Live video</h3>

<p class="govuk-body">We do not plan to add captions to live video streams because live video is <a href="http://www.legislation.gov.uk/uksi/2018/952/regulation/4/made" class="govuk-link">exempt from meeting
<p class="govuk-body">We do not plan to add captions to live video streams because live video is <a href="https://www.legislation.gov.uk/uksi/2018/952/regulation/4/made" class="govuk-link">exempt from meeting
the accessibility regulations</a>.</p>

<h2 class="govuk-heading-l">What we’re doing to improve accessibility</h2>
Expand Down Expand Up @@ -249,4 +251,4 @@ <h2 class="govuk-heading-l">Preparation of this accessibility statement</h2>
}) }}
</div>
</div>
{% endblock %}
{% endblock content %}
30 changes: 19 additions & 11 deletions app/templates/main/cookies.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%}
{%- from 'govuk_frontend_jinja/components/table/macro.html' import govukTable -%}

{% block pageTitle %}{%- if form.errors %}Error: {% endif -%}Cookies – {{config['SERVICE_NAME']}} – GOV.UK{% endblock %}
{% block pageTitle %}
{%- if form.errors %}
Error:
{% endif -%}
Cookies – {{ config['SERVICE_NAME'] }} – GOV.UK
{% endblock pageTitle %}

{% block content %}
<div class="govuk-grid-row">
Expand All @@ -12,12 +17,13 @@
<h1 class="govuk-heading-l">Cookies</h1>
<p class="govuk-body">Cookies are small files saved on your phone, tablet or computer when you visit a website.
</p>
<p class="govuk-body">We use cookies to make {{config['SERVICE_NAME']}} work and collect information about how you use our
<p class="govuk-body">We use cookies to make {{ config['SERVICE_NAME'] }} work and collect information about how you use our
service.</p>

<h2 class="govuk-heading-m">Essential cookies</h2>
<p class="govuk-body">Essential cookies keep your information secure while you use {{config['SERVICE_NAME']}}. We do not need
<p class="govuk-body">Essential cookies keep your information secure while you use {{ config['SERVICE_NAME'] }}. We do not need
to ask permission to use them.</p>

{{ govukTable(
{
'head': [{'text': 'Name'}, {'text': 'Purpose'}, {'text': 'Expires'}],
Expand All @@ -26,38 +32,40 @@ <h2 class="govuk-heading-m">Essential cookies</h2>
[{'text': 'session'}, {'text': 'Temporary storage'}, {'text': 'Session'}]
]
}
)}}
) }}

<h2 class="govuk-heading-m">Functional cookies</h2>
<p class="govuk-body">Functional cookies allow you to take advantage of some functionality, for example remembering
settings between visits. The service will work without them.</p>

{{ govukTable(
{
'head': [{'text': 'Name'}, {'text': 'Purpose'}, {'text': 'Expires'}],
'rows': [
[{'text': 'foo'}, {'text': 'bar'}, {'text': 'baz'}]
]
}
)}}
) }}

<h2 class="govuk-heading-m">Analytics cookies</h2>
<p class="govuk-body">With your permission, we use Google Analytics to collect data about how you use {{config['SERVICE_NAME']}}. This
<p class="govuk-body">With your permission, we use Google Analytics to collect data about how you use {{ config['SERVICE_NAME'] }}. This
information helps us to improve our service.</p>
<p class="govuk-body">Google is not allowed to use or share our analytics data with anyone.</p>
<p class="govuk-body">Google Analytics stores anonymised information about:</p>
<ul class="govuk-list govuk-list--bullet">
<li>how you got to {{config['SERVICE_NAME']}}</li>
<li>the pages you visit on {{config['SERVICE_NAME']}} and how long you spend on them</li>
<li>any errors you see while using {{config['SERVICE_NAME']}}</li>
<li>how you got to {{ config['SERVICE_NAME'] }}</li>
<li>the pages you visit on {{ config['SERVICE_NAME'] }} and how long you spend on them</li>
<li>any errors you see while using {{ config['SERVICE_NAME'] }}</li>
</ul>

{{ govukTable(
{
'head': [{'text': 'Name'}, {'text': 'Purpose'}, {'text': 'Expires'}],
'rows': [
[{'text': 'foo'}, {'text': 'bar'}, {'text': 'baz'}]
]
}
)}}
) }}

<h2 class="govuk-heading-m">Change your cookie settings</h2>
<form action="" method="post" novalidate>
Expand All @@ -68,4 +76,4 @@ <h2 class="govuk-heading-m">Change your cookie settings</h2>
</form>
</div>
</div>
{% endblock %}
{% endblock content %}
Loading

0 comments on commit 85e08e4

Please sign in to comment.