From 810e880bb5135012351e83b06ccc040451f922ca Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Thu, 14 Nov 2019 16:22:06 +0000 Subject: [PATCH] Update all, but one, `
` to component Includes: - in gulpfile.js: - add details macro to list of those copied from GOVUK Frontend - remove existing details polyfill - convert all, but one,
tags to use GOVUK Frontend details component - add jinja boolean filter to help setting 'open' attribute of
tags Notes on the `
` not included in this: The `
` used for notifications items on the API integration page is not possible to reproduce with the GOV.UK Frontend macro so I'm splitting the resulting work out into it's own commit. --- app/__init__.py | 1 + .../stylesheets/govuk-frontend/_all.scss | 1 + app/templates/views/get-started.html | 32 ++++++++++--------- app/templates/views/platform-admin/index.html | 13 ++++++-- .../views/platform-admin/services.html | 26 +++++++++------ gulpfile.js | 4 +-- 6 files changed, 47 insertions(+), 30 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 4c24d5b28..59b918f81 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -743,6 +743,7 @@ def add_template_filters(application): format_phone_number_human_readable, format_thousands, id_safe, + convert_to_boolean, ]: application.add_template_filter(fn) diff --git a/app/assets/stylesheets/govuk-frontend/_all.scss b/app/assets/stylesheets/govuk-frontend/_all.scss index 760d837cc..9ecefd894 100644 --- a/app/assets/stylesheets/govuk-frontend/_all.scss +++ b/app/assets/stylesheets/govuk-frontend/_all.scss @@ -17,6 +17,7 @@ $govuk-assets-path: "/static/"; @import 'components/header/_header'; @import 'components/footer/_footer'; @import 'components/back-link/_back-link'; +@import 'components/details/_details'; @import "utilities/all"; @import "overrides/all"; diff --git a/app/templates/views/get-started.html b/app/templates/views/get-started.html index 09e165a8d..0d20b17b9 100644 --- a/app/templates/views/get-started.html +++ b/app/templates/views/get-started.html @@ -1,6 +1,7 @@ {% extends "content_template.html" %} {% from "components/table.html" import mapping_table, row, text_field, edit_field, field with context %} {% from "components/sub-navigation.html" import sub_navigation %} +{% from "components/details/macro.njk" import govukDetails %} {% block per_page_title %} Get started @@ -14,21 +15,22 @@
  • Check if GOV.UK Notify is right for you

    Read about our features, pricing and roadmap.

    -
    - Organisations that can use Notify -
    -

    Notify is available to:

    -
      -
    • central government departments
    • -
    • local authorities
    • -
    • state-funded schools
    • -
    • housing associations
    • -
    • the NHS
    • -
    • companies owned by local or central government that deliver services on their behalf
    • -
    -

    Notify is not currently available to charities.

    -
    -
    + {{ govukDetails({ + "summaryText": "Organisations that can use Notify", + "html": ''' +
    +

    Notify is available to:

    +
      +
    • central government departments
    • +
    • local authorities
    • +
    • state-funded schools
    • +
    • housing associations
    • +
    • the NHS
    • +
    • companies owned by local or central government that deliver services on their behalf
    • +
    +

    Notify is not currently available to charities.

    +
    ''' + }) }}
  • diff --git a/app/templates/views/platform-admin/index.html b/app/templates/views/platform-admin/index.html index 6da4e87d2..03fb8a021 100644 --- a/app/templates/views/platform-admin/index.html +++ b/app/templates/views/platform-admin/index.html @@ -4,6 +4,7 @@ {% from "components/message-count-label.html" import message_count_label %} {% from "components/status-box.html" import status_box %} {% from "components/form.html" import form_wrapper %} +{% from "components/details/macro.njk" import govukDetails %} {% block per_page_title %} Platform admin @@ -14,15 +15,21 @@

    Summary

    -
    - Apply filters + + {% set details_content %} {% call form_wrapper(method="get") %} {{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }} {{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
    {% endcall %} -
    + {% endset %} + + {{ govukDetails({ + "summaryText": "Help with nationality", + "html": details_content, + "open": form.errors | convert_to_boolean + }) }}
    {% for noti_type in global_stats %} diff --git a/app/templates/views/platform-admin/services.html b/app/templates/views/platform-admin/services.html index c10abb095..c42a76af7 100644 --- a/app/templates/views/platform-admin/services.html +++ b/app/templates/views/platform-admin/services.html @@ -6,6 +6,7 @@ {% from "components/message-count-label.html" import message_count_label %} {% from "components/table.html" import mapping_table, field, stats_fields, row_group, row, right_aligned_field_heading, hidden_field_heading, text_field %} {% from "components/form.html" import form_wrapper %} +{% from "components/details/macro.njk" import govukDetails %} {% macro stats_fields(channel, data) -%} @@ -101,16 +102,21 @@ {{ page_title|capitalize }} -
    - Apply filters - {% call form_wrapper(method="get") %} - {{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }} - {{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }} - {{ checkbox(form.include_from_test_key) }} -
    - - {% endcall %} -
    + + {% set details_content %} + {% call form_wrapper(method="get") %} + {{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }} + {{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }} + {{ checkbox(form.include_from_test_key) }} +
    + + {% endcall %} + {% endset %} + + {{ govukDetails({ + "summaryText": "Apply filters", + "html": details_content + }) }} {% include "views/platform-admin/_global_stats.html" %} diff --git a/gulpfile.js b/gulpfile.js index ff2903295..257aef277 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -63,7 +63,8 @@ const copy = { 'skip-link', 'header', 'footer', - 'back-link' + 'back-link', + 'details' ]; let done = 0; @@ -143,7 +144,6 @@ const javascripts = () => { paths.src + 'javascripts/govuk/cookie-functions.js', paths.src + 'javascripts/cookieMessage.js', paths.src + 'javascripts/stick-to-window-when-scrolling.js', - paths.src + 'javascripts/detailsPolyfill.js', paths.src + 'javascripts/apiKey.js', paths.src + 'javascripts/autofocus.js', paths.src + 'javascripts/enhancedTextbox.js',