Skip to content

Commit

Permalink
Merge pull request #23 from LandRegistry/govuk-frontend-3.13.0
Browse files Browse the repository at this point in the history
GOV.UK Frontend v3.13.0
  • Loading branch information
matthew-shaw committed Jun 29, 2021
2 parents 49adda1 + 2526181 commit 47be1bd
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 120 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/python-app.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 safety
pip install -r requirements-test.txt
- name: Check dependencies for known security vulnerabilities
run: safety check -r requirements-test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Prepare to test
run: |
sudo apt-get install wait-for-it
curl -L https://github.com/surevine/govuk-frontend-diff/releases/download/v1.1.1/govuk-frontend-diff-linux --output govuk-frontend-diff
chmod +x govuk-frontend-diff
- name: Test with govuk-frontend-diff
run: |
(cd tests/utils && nohup python -m flask run --port 3000 &)
wait-for-it localhost:3000
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.13.0 --ci
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/LandRegistry/govuk-frontend-jinja/compare/1.3.0...main)
## [Unreleased](https://github.com/LandRegistry/govuk-frontend-jinja/compare/1.4.0...main)

## [1.4.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/1.4.0) - 29/06/2021

### Changed

- Update to [GOV.UK Frontend v3.13.0](https://github.com/alphagov/govuk-frontend/releases/tag/v3.13.0)

## [1.3.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/1.3.0) - 21/05/2021

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GOV.UK Frontend Jinja Macros

[![PyPI version](https://badge.fury.io/py/govuk-frontend-jinja.svg)](https://pypi.org/project/govuk-frontend-jinja/)
![govuk-frontend 3.12.0](https://img.shields.io/badge/govuk--frontend%20version-3.12.0-005EA5?logo=gov.uk&style=flat)
![govuk-frontend 3.13.0](https://img.shields.io/badge/govuk--frontend%20version-3.13.0-005EA5?logo=gov.uk&style=flat)
![Build](https://github.com/LandRegistry/govuk-frontend-jinja/workflows/Build/badge.svg)

**This is a [GOV.UK Design System Community Resource](https://design-system.service.gov.uk/community/resources-and-tools/), created and maintained by HM Land Registry**
Expand Down Expand Up @@ -43,7 +43,7 @@ There is a test server at `tests/utils/app.py` which you will need to run using
You can then run the tests using `govuk-frontend-diff` as follows:

```bash
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.12.0
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.13.0
```

This is all wrapped up in `./test.sh` for simplified running (Requires Docker).
Expand Down
81 changes: 39 additions & 42 deletions govuk_frontend_jinja/templates/components/checkboxes/macro.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@
{% set ns.describedBy = params.fieldset.describedBy %}
{% endif %}

{% set ns.isConditional = False %}
{% for item in params['items'] %}
{% if item.conditional and item.conditional.html %}
{% set ns.isConditional = True %}
{% endif %}
{% endfor %}

{#- fieldset is False by default -#}
{#- fieldset is false by default -#}
{% set hasFieldset = True if params.fieldset else False %}

{#- Capture the HTML so we can optionally nest it in a fieldset -#}
Expand Down Expand Up @@ -54,7 +47,7 @@
{% endif %}
<div class="govuk-checkboxes {%- if params.classes %} {{ params.classes }}{% endif %}"
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}
{%- if ns.isConditional %} data-module="govuk-checkboxes"{% endif -%}>
data-module="govuk-checkboxes">
{% for item in params['items'] %}
{% if item %}
{#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
Expand All @@ -70,38 +63,43 @@
{%- endif -%}
{% set name = item.name if item.name else params.name %}
{% set conditionalId = "conditional-" + id %}
{% set hasHint = True if (item.hint.text if item.hint and item.hint.text) or (item.hint.html if item.hint and item.hint.html) %}
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
{% set itemDescribedBy = ns.describedBy if not hasFieldset else "" %}
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %}
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
{{-" checked" if item.checked }}
{{-" disabled" if item.disabled }}
{%- if item.conditional and item.conditional.html %} data-aria-controls="{{ conditionalId }}"{% endif -%}
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
{%- for attribute, value in (item.attributes.items() if item.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor -%}>
{{ govukLabel({
'html': item.html,
'text': item.text,
'classes': 'govuk-checkboxes__label' + (' ' + item.label.classes if item.label and item.label.classes else ''),
'attributes': (item.label.attributes if item.label and item.label.attributes),
'for': id
}) | trim }}
{% if hasHint %}
{{ govukHint({
'id': itemHintId,
'classes': 'govuk-checkboxes__hint' + (' ' + item.hint.classes if item.hint.classes else ''),
'attributes': item.hint.attributes,
'html': item.hint.html,
'text': item.hint.text
}) | trim }}
{% endif %}
</div>
{% if item.conditional and item.conditional.html %}
<div class="govuk-checkboxes__conditional{% if not item.checked %} govuk-checkboxes__conditional--hidden{% endif %}" id="{{ conditionalId }}">
{{ item.conditional.html | safe }}
{%- if item.divider %}
<div class="govuk-checkboxes__divider">{{ item.divider }}</div>
{%- else %}
{% set hasHint = True if (item.hint.text if item.hint and item.hint.text) or (item.hint.html if item.hint and item.hint.html) %}
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
{% set itemDescribedBy = ns.describedBy if not hasFieldset else "" %}
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %}
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
{{-" checked" if item.checked }}
{{-" disabled" if item.disabled }}
{%- if item.conditional and item.conditional.html %} data-aria-controls="{{ conditionalId }}"{% endif -%}
{%- if item.behaviour %} data-behaviour="{{ item.behaviour }}"{% endif -%}
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
{%- for attribute, value in (item.attributes.items() if item.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor -%}>
{{ govukLabel({
'html': item.html,
'text': item.text,
'classes': 'govuk-checkboxes__label' + (' ' + item.label.classes if item.label and item.label.classes else ''),
'attributes': (item.label.attributes if item.label and item.label.attributes),
'for': id
}) | trim }}
{% if hasHint %}
{{ govukHint({
'id': itemHintId,
'classes': 'govuk-checkboxes__hint' + (' ' + item.hint.classes if item.hint.classes else ''),
'attributes': item.hint.attributes,
'html': item.hint.html,
'text': item.hint.text
}) | trim }}
{% endif %}
</div>
{% if item.conditional and item.conditional.html %}
<div class="govuk-checkboxes__conditional{% if not item.checked %} govuk-checkboxes__conditional--hidden{% endif %}" id="{{ conditionalId }}">
{{ item.conditional.html | safe }}
</div>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
Expand All @@ -122,5 +120,4 @@
{{ innerHtml | trim | safe }}
{% endif %}
</div>

{% endmacro %}
{% endmacro %}
18 changes: 5 additions & 13 deletions govuk_frontend_jinja/templates/components/header/macro.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<div class="govuk-header__logo">
<a href="{{ params.homepageUrl | default('/') }}" class="govuk-header__link govuk-header__link--homepage">
<span class="govuk-header__logotype">
<!--[if gt IE 8]><!-->
{#- We use an inline SVG for the crown so that we can cascade the
currentColor into the crown whilst continuing to support older browsers
which do not support external SVGs without a Javascript polyfill. This
adds approximately 1kb to every page load.

We use currentColour so that we can easily invert it when printing and
when the focus state is applied. This also benefits users who override
colours in their browser as they will still see the crown.

The SVG needs `focusable="false"` so that Internet Explorer does not
treat it as an interactive element - without this it will be
'focusable' when using the keyboard to navigate. #}
Expand All @@ -30,18 +29,11 @@
fill="currentColor" fill-rule="evenodd"
d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 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11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
></path>
{#- Fallback PNG image for older browsers.

The <image> element is a valid SVG element. In SVG, you would specify
the URL of the image file with the xlink:href – as we don't reference an
image it has no effect. It's important to include an empty data URI
as the xlink:href attribute as this prevents versions of IE which
support SVG from downloading the fallback image when they don't need to.

In other browsers <image> is synonymous for the <img> tag and will be
interpreted as such, displaying the fallback image. #}
<image src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" xlink:href="data:," display="none" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
</svg>
<!--<![endif]-->
<!--[if IE 8]>
<img src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="36" height="32">
<![endif]-->
<span class="govuk-header__logotype-text">
GOV.UK
</span>
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flake8==3.9.2
flask==1.1.4 # Latest 2.0.0
flask==1.1.4 # Latest 2.0.1
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile requirements-test.in
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setuptools.setup(
name="govuk-frontend-jinja",
version="1.3.0",
version="1.4.0",
author="Matt Shaw",
author_email="matthew.shaw@landregistry.gov.uk",
description="GOV.UK Frontend Jinja Macros",
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
flake8 .
(cd tests/utils && nohup python -m flask run --port 3000 &)
wait-for-it localhost:3000
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.12.0
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.13.0

0 comments on commit 47be1bd

Please sign in to comment.