From a132880edeb102350cfcdb42520c7ca819fd0779 Mon Sep 17 00:00:00 2001 From: Ben Meyrick Date: Thu, 20 Dec 2018 15:46:22 +0000 Subject: [PATCH] Fix homepage rendering (#4) --- .editorconfig | 2 +- .../beta-bar/examples/beta-bar/index.njk | 4 +- src/components/button/src/_template.njk | 6 +- .../card/examples/card-set/index.njk | 16 ++- src/components/card/src/_macro.njk | 6 +- src/components/card/src/_template.njk | 10 +- .../checkboxes/src/_checkbox-macro.njk | 2 +- src/components/password/src/_macro.njk | 8 +- src/components/radios/src/_template.njk | 2 +- src/components/select/src/_macro.njk | 6 +- src/components/textarea/src/_template.njk | 4 +- src/index.njk | 99 +++++++++---------- .../examples/error-details/index.njk | 16 +-- .../examples/errors-proto/errors/index.njk | 4 +- .../examples/errors-proto/index.njk | 66 ++++++------- src/patterns/error-validation/index.njk | 4 +- src/views/layouts/_home.njk | 2 - 17 files changed, 121 insertions(+), 136 deletions(-) diff --git a/.editorconfig b/.editorconfig index 168a67c6c6..2ec4a16a29 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,4 +17,4 @@ indent_size = 2 indent_size = 2 # Templates [*.pug,*.jade,*.njk] -indent_size = 2 +indent_size = 4 diff --git a/src/components/beta-bar/examples/beta-bar/index.njk b/src/components/beta-bar/examples/beta-bar/index.njk index 2c655a89f1..120a5834b3 100644 --- a/src/components/beta-bar/examples/beta-bar/index.njk +++ b/src/components/beta-bar/examples/beta-bar/index.njk @@ -2,9 +2,9 @@ "fullWidth": true --- {% from "components/beta-bar/src/_macro.njk" import onsBetaBar %} -{{- +{{ onsBetaBar({ "beta": "BETA", "html": 'This is a new service – your feedback will help us improve it.' }) --}} +}} diff --git a/src/components/button/src/_template.njk b/src/components/button/src/_template.njk index dec243426c..c9bbd14337 100644 --- a/src/components/button/src/_template.njk +++ b/src/components/button/src/_template.njk @@ -17,13 +17,13 @@ {#- Create a button or a link #} {% if element == 'a' %} - + {{ params.html | safe if params.html else params.text }} {% elseif element == 'button' %} - {% elseif element == 'input' %} - + {% endif %} diff --git a/src/components/card/examples/card-set/index.njk b/src/components/card/examples/card-set/index.njk index 56bc7f5193..9b869fddcc 100644 --- a/src/components/card/examples/card-set/index.njk +++ b/src/components/card/examples/card-set/index.njk @@ -1,31 +1,29 @@ +{% from "components/card/src/_macro.njk" import onsCard %}
- {% from "components/card/src/_macro.njk" import onsCard %} - {{ + {{- onsCard({ "title": 'Search for a business', "href": '#', - "text": 'A list of UK businesses for statistical use across government. ' + "text": 'A list of UK businesses for statistical use across government.' }) }}
- {% from "components/card/src/_macro.njk" import onsCard %} - {{ + {{- onsCard({ "title": 'Record management', "href": '#', - "text": 'Edit, create new records and view the editing history of businesses. ' + "text": 'Edit, create new records and view the editing history of businesses.' }) }}
- {% from "components/card/src/_macro.njk" import onsCard %} - {{ + {{- onsCard({ "title": 'Address index', "href": '#', - "text": 'The most accurate and greographical dataset of addresses and properties in the UK ' + "text": 'The most accurate and greographical dataset of addresses and properties in the UK.' }) }}
diff --git a/src/components/card/src/_macro.njk b/src/components/card/src/_macro.njk index 9a0951782c..1fe519744b 100644 --- a/src/components/card/src/_macro.njk +++ b/src/components/card/src/_macro.njk @@ -1,3 +1,3 @@ -{% macro onsCard(params) %} - {% include "components/card/src/_template.njk" %} -{% endmacro %} +{%- macro onsCard(params) -%} +{% include "components/card/src/_template.njk" %} +{%- endmacro -%} diff --git a/src/components/card/src/_template.njk b/src/components/card/src/_template.njk index 4b5997214c..190e1845bd 100644 --- a/src/components/card/src/_template.njk +++ b/src/components/card/src/_template.njk @@ -1,9 +1,11 @@

- {% if params.href %} - {{ params.title }} - {% else %} - {{ params.title }} + {% if params.href -%} + + {{ params.title }} + + {%- else %} + {{ params.title }} {% endif %}

{{ params.text }}

diff --git a/src/components/checkboxes/src/_checkbox-macro.njk b/src/components/checkboxes/src/_checkbox-macro.njk index 2556ecba9e..464cd738a3 100644 --- a/src/components/checkboxes/src/_checkbox-macro.njk +++ b/src/components/checkboxes/src/_checkbox-macro.njk @@ -2,7 +2,7 @@