govuk-design-system-rails 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/app/views/components/_govuk_accordion.html.erb +1 -1
- data/app/views/components/_govuk_action_link.html.erb +1 -1
- data/app/views/components/_govuk_checkboxes.html.erb +33 -33
- data/app/views/components/_govuk_cookie_banner.html.erb +15 -15
- data/app/views/components/_govuk_date_input.html.erb +19 -18
- data/app/views/components/_govuk_error_summary.html.erb +1 -1
- data/app/views/components/_govuk_fieldset.html.erb +2 -2
- data/app/views/components/_govuk_header.html.erb +2 -2
- data/app/views/components/_govuk_input.html.erb +61 -71
- data/app/views/components/_govuk_inset_text.html.erb +1 -1
- data/app/views/components/_govuk_notification_banner.html.erb +11 -11
- data/app/views/components/_govuk_radios.html.erb +37 -38
- data/app/views/components/_govuk_select.html.erb +18 -14
- data/app/views/components/_govuk_summary_list.html.erb +1 -1
- data/app/views/components/_govuk_tabs.html.erb +3 -3
- data/app/views/components/_govuk_textarea.html.erb +27 -28
- data/app/views/form_components/_govuk_date_input.html.erb +18 -18
- data/app/views/form_components/_govuk_radios.html.erb +2 -2
- data/app/views/form_components/_govuk_select.html.erb +2 -2
- data/govuk-design-system-rails.gemspec +32 -0
- data/spec/helpers/govuk_design_system/checkboxes_helper_spec.rb +71 -0
- data/spec/helpers/govuk_design_system/select_helper_spec.rb +51 -0
- metadata +112 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d9c752c65f527e2c23a15a9955ab438f2d422581debc5ffe196af752af35ae8
|
4
|
+
data.tar.gz: eea66bc7582da74d5b46165644293bc011d4c7cc142a9b19ac02aad828b19059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821f93c096c7c7dd5d334ae98a2184285a9cc33ba90c2cabb62deed84267fdb57894febceb0e3a59599fe707b28ae1499feb44a8251c55d5e1760df7208534a8
|
7
|
+
data.tar.gz: a845dbed683c15887574fb8ec6ac24714b8a11afa07b09d06eb6171352b826fa724a8dc590c2b7f70f88d68f79b830feb7964a885ae6455b36ed80eb8d76b324
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 govuk-ruby
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# GOV.UK Design System
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/govuk-design-system-rails.svg)](https://rubygems.org/gems/govuk-design-system-rails)
|
4
|
+
![RSpec test suite](https://github.com/govuk-ruby/govuk-design-system-rails/workflows/RSpec%20test%20suite/badge.svg?branch=master)
|
5
|
+
![Code style](https://github.com/govuk-ruby/govuk-design-system-rails/workflows/Code%20style/badge.svg?branch=master)
|
6
|
+
|
7
|
+
This gem contains a [Rails engine](https://guides.rubyonrails.org/engines.html) containing a Ruby on Rails port of some [GOV.UK Design System](https://design-system.service.gov.uk/) components.
|
8
|
+
|
9
|
+
It was originally extracted from Ruby applications built by the Office for Product Safety and Standards (see: https://github.com/UKGovernmentBEIS/beis-opss/pull/1374) and is by no means complete. Not every component is implemented and some components may not behave in exactly the same way as the originals. The project does aim for feature parity and PRs are welcome.
|
10
|
+
|
11
|
+
## Compatibility
|
12
|
+
|
13
|
+
You **must** include the [govuk-frontend](https://github.com/alphagov/govuk-frontend/) assets (CSS, JS, images, etc.) in your application in order to make use of this library. These assets are not bundled with this gem. This gem aims for parity with a specific version of the `govuk-frontend` library.
|
14
|
+
|
15
|
+
| This gem's version | Compatible with `govuk-frontend` version |
|
16
|
+
|--------------------| --- |
|
17
|
+
| 0.9.7 | 4.3.1 |
|
18
|
+
| 0.9.0 | 4.1.0 |
|
19
|
+
| 0.8.2 | 3.14.0 |
|
20
|
+
|
21
|
+
# Installation
|
22
|
+
|
23
|
+
Add the following to your project's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem "govuk-design-system-rails"
|
27
|
+
```
|
28
|
+
and run `bundle install`
|
29
|
+
|
30
|
+
# Design System Components
|
31
|
+
|
32
|
+
The [GOV.UK design system](https://design-system.service.gov.uk) provides a reference implementation of its components in Nunjucks, which are unfortunately not supported on Ruby. In lieu of that, we are implementing
|
33
|
+
ERB versions of the components that can be used throughout the applications.
|
34
|
+
|
35
|
+
## Component implementations
|
36
|
+
|
37
|
+
Component implementations can be found in the [components directory](app/views/components). They try to follow the
|
38
|
+
nunjucks implementations as close as possible. In particular, we are keeping the interface the same (param names etc.)
|
39
|
+
to make translating code between the macros usage and our implementation as close as possible.
|
40
|
+
This means that we can use the documentation provided by design system for macro options,
|
41
|
+
e.g. see [macro options for radios](https://design-system.service.gov.uk/components/radios/#options-example-default)
|
42
|
+
|
43
|
+
Notable differences from nunjucks:
|
44
|
+
- we are not allowing unescaped html in `html` attributes. Instead, the expected use-case is to build the required html
|
45
|
+
and `capture` it, e.g.:
|
46
|
+
```erb
|
47
|
+
<% html = capture do %>
|
48
|
+
<h3>Custom html content</h3>
|
49
|
+
<% end %>
|
50
|
+
<%= govukLabel html: html, for: "someId" %>
|
51
|
+
```
|
52
|
+
This renders most `text` and `html` attributes functionally identical, but we are choosing to keep both for consistency
|
53
|
+
with nunjucks templates
|
54
|
+
- We extended the govukSelect component to streamline using it as accessible autocomplete component.
|
55
|
+
Our version accepts extra options:
|
56
|
+
- is_autocomplete, when true, makes the select an
|
57
|
+
[accessible autocomplete](https://github.com/alphagov/accessible-autocomplete)
|
58
|
+
- show_all_values, when true and is_autocomplete true, makes the autocomplete show all values,
|
59
|
+
as well as adds an 'x' to remove currently selected value.
|
60
|
+
- hidden fields in checkboxes, to account for rails checkboxes "gotcha". The default value is 0 but can be set through the 'unchecked_value' attribute.
|
61
|
+
https://apidock.com/rails/ActionView/Helpers/FormHelper/check_box
|
62
|
+
|
63
|
+
## Rails integration
|
64
|
+
|
65
|
+
To simplify working with rails form helpers, we are also providing a bit of "glue" which infers the values that it
|
66
|
+
can from the form object and converts them into appropriate params for the view components. Those can be found
|
67
|
+
in the [form_components directory](app/views/form_components).
|
68
|
+
|
69
|
+
The intent of keeping this "glue" separate from the component implementations is to make keeping the components up to
|
70
|
+
date with the corresponding macros as simple as possible.
|
71
|
+
|
72
|
+
The helpers accept a `form` parameter, when this is present, the `form_components` version of a component is used.
|
@@ -18,7 +18,7 @@
|
|
18
18
|
%>
|
19
19
|
<%= tag.div(**div_attributes) do %>
|
20
20
|
<% local_assigns[:items].each.with_index(1) do |item, index| %>
|
21
|
-
<% next
|
21
|
+
<% next if item.blank? %>
|
22
22
|
<div class="<%= class_names "govuk-accordion__section", { "govuk-accordion__section--expanded" => item[:expanded] } %>">
|
23
23
|
<div class="govuk-accordion__section-header">
|
24
24
|
<h<%= heading_level %> class="govuk-accordion__section-heading">
|
@@ -4,7 +4,7 @@
|
|
4
4
|
href: local_assigns[:href]
|
5
5
|
}.merge!(local_assigns[:attributes] || {})
|
6
6
|
%>
|
7
|
-
<%= tag.a
|
7
|
+
<%= tag.a(**link_attributes) do %>
|
8
8
|
<%= local_assigns[:html].presence || local_assigns[:text] %>
|
9
9
|
<% if local_assigns[:visuallyHiddenText].present? %>
|
10
10
|
<span class="govuk-visually-hidden"> <%= local_assigns[:visuallyHiddenText] %></span>
|
@@ -12,12 +12,12 @@
|
|
12
12
|
described_by = described_by.present? ? "#{described_by} #{hint_id}" : hint_id
|
13
13
|
%>
|
14
14
|
<%= govukHint(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
id: hint_id,
|
16
|
+
classes: local_assigns.dig(:hint, :classes),
|
17
|
+
attributes: local_assigns.dig(:hint, :attributes) || {},
|
18
|
+
html: local_assigns.dig(:hint, :html),
|
19
|
+
text: local_assigns.dig(:hint, :text)
|
20
|
+
) %>
|
21
21
|
<% end %>
|
22
22
|
|
23
23
|
<% if local_assigns[:errorMessage] %>
|
@@ -26,13 +26,13 @@
|
|
26
26
|
described_by = described_by.present? ? "#{described_by} #{error_id}" : error_id
|
27
27
|
%>
|
28
28
|
<%= govukErrorMessage(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
id: error_id,
|
30
|
+
classes: local_assigns.dig(:errorMessage, :classes),
|
31
|
+
attributes: local_assigns.dig(:errorMessage, :attributes) || {},
|
32
|
+
html: local_assigns.dig(:errorMessage, :html),
|
33
|
+
text: local_assigns.dig(:errorMessage, :text),
|
34
|
+
visuallyHiddenText: local_assigns.dig(:errorMessage, :visuallyHiddenText)
|
35
|
+
) %>
|
36
36
|
<% end %>
|
37
37
|
|
38
38
|
<%
|
@@ -41,7 +41,7 @@
|
|
41
41
|
data: { module: "govuk-checkboxes" }
|
42
42
|
}.merge!(local_assigns[:attributes] || {})
|
43
43
|
%>
|
44
|
-
<%= tag.div
|
44
|
+
<%= tag.div(**div_attributes) do %>
|
45
45
|
<% (local_assigns[:items] || []).each_with_index do |item, index| %>
|
46
46
|
<% if item.present? %>
|
47
47
|
<%
|
@@ -63,11 +63,11 @@
|
|
63
63
|
<div class="govuk-checkboxes__item">
|
64
64
|
<%
|
65
65
|
input_attributes = {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
id: item_id,
|
67
|
+
name: name,
|
68
|
+
type: "checkbox",
|
69
|
+
value: item[:value],
|
70
|
+
data: {}
|
71
71
|
}.merge!(item[:attributes] || {})
|
72
72
|
input_attributes[:class] = class_names("govuk-checkboxes__input", input_attributes[:class])
|
73
73
|
input_attributes[:checked] = true if is_checked
|
@@ -76,22 +76,22 @@
|
|
76
76
|
input_attributes[:data][:behaviour] = item[:behaviour] if item[:behaviour].present?
|
77
77
|
input_attributes["aria-describedby"] = item_described_by if item_described_by.present?
|
78
78
|
%>
|
79
|
-
<%= tag.input
|
79
|
+
<%= tag.input(**input_attributes) %>
|
80
80
|
<%= govukLabel(
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
html: item[:html],
|
82
|
+
text: item[:text],
|
83
|
+
classes: class_names("govuk-checkboxes__label", item.dig(:label, :classes)),
|
84
|
+
attributes: item.dig(:label, :attributes) || {},
|
85
|
+
for: item_id
|
86
|
+
) %>
|
87
87
|
<% if has_hint %>
|
88
88
|
<%= govukHint(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
id: item_hint_id,
|
90
|
+
classes: class_names("govuk-checkboxes__hint", item.dig(:hint, :classes)),
|
91
|
+
attributes: item.dig(:hint, :attributes) || {},
|
92
|
+
html: item.dig(:hint, :html),
|
93
|
+
text: item.dig(:hint, :text)
|
94
|
+
) %>
|
95
95
|
<% end %>
|
96
96
|
</div>
|
97
97
|
<% if item.dig(:conditional, :html).present? %>
|
@@ -118,7 +118,7 @@
|
|
118
118
|
%>
|
119
119
|
<%= tag.div class: form_group_classes do %>
|
120
120
|
<% if has_fieldset %>
|
121
|
-
<%= govukFieldset(classes:
|
121
|
+
<%= govukFieldset(classes: local_assigns[:fieldset][:classes], describedBy: described_by.presence, legend: local_assigns[:fieldset][:legend], attributes: local_assigns[:fieldset]) { inner_html } %>
|
122
122
|
<% else %>
|
123
123
|
<%= inner_html %>
|
124
124
|
<% end %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
div_attributes[:hidden] = "hidden" if local_assigns[:hidden]
|
10
10
|
%>
|
11
11
|
<% unless cookies[:seen_cookie_message] %>
|
12
|
-
<%= tag.div
|
12
|
+
<%= tag.div(**div_attributes) do %>
|
13
13
|
<% (local_assigns[:messages] || []).each do |message| %>
|
14
14
|
<%
|
15
15
|
message_attributes = {
|
@@ -18,7 +18,7 @@
|
|
18
18
|
message_attributes[:hidden] = "hidden" if message[:hidden]
|
19
19
|
message_attributes[:role] = message[:role] if message[:role]
|
20
20
|
%>
|
21
|
-
<%= tag.div
|
21
|
+
<%= tag.div(**message_attributes) do %>
|
22
22
|
<div class="govuk-grid-row">
|
23
23
|
<div class="govuk-grid-column-two-thirds">
|
24
24
|
<% if message[:headingHtml] || message[:headingText] %>
|
@@ -42,12 +42,12 @@
|
|
42
42
|
<% if action[:href].present? %>
|
43
43
|
<% if action[:type] == "button" %>
|
44
44
|
<%= govukButton({
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
"text": action[:text],
|
46
|
+
"type": "button",
|
47
|
+
"classes": action[:classes] || [],
|
48
|
+
"href": action[:href],
|
49
|
+
"attributes": action[:attributes] || {}
|
50
|
+
}) %>
|
51
51
|
<% else %>
|
52
52
|
<%
|
53
53
|
link_attributes = {
|
@@ -58,13 +58,13 @@
|
|
58
58
|
<% end %>
|
59
59
|
<% else %>
|
60
60
|
<%= govukButton({
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
"text": action[:text],
|
62
|
+
"value": action[:value],
|
63
|
+
"name": action[:name],
|
64
|
+
"type": action[:type],
|
65
|
+
"classes": action[:classes] || [],
|
66
|
+
"attributes": action[:attributes] || {}
|
67
|
+
}) %>
|
68
68
|
<% end %>
|
69
69
|
<% end %>
|
70
70
|
</div>
|
@@ -1,17 +1,17 @@
|
|
1
1
|
<%
|
2
2
|
described_by = local_assigns[:described_by] || ""
|
3
3
|
date_input_items = local_assigns[:items] ||
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
[
|
5
|
+
{ name: "day", classes: "govuk-input--width-2" },
|
6
|
+
{ name: "month", classes: "govuk-input--width-2" },
|
7
|
+
{ name: "year", classes: "govuk-input--width-4" }
|
8
|
+
]
|
9
9
|
%>
|
10
10
|
<% date_input = capture do %>
|
11
11
|
<% if local_assigns[:hint] %>
|
12
12
|
<%
|
13
|
-
hint_id = local_assigns[:id]
|
14
|
-
described_by = described_by.present? ? described_by
|
13
|
+
hint_id = "#{local_assigns[:id]}-hint"
|
14
|
+
described_by = described_by.present? ? "#{described_by} #{hint_id}" : hint_id
|
15
15
|
%>
|
16
16
|
<%=
|
17
17
|
govukHint(
|
@@ -22,9 +22,9 @@
|
|
22
22
|
<% end %>
|
23
23
|
<% if local_assigns[:errorMessage] %>
|
24
24
|
<%
|
25
|
-
error_id = local_assigns[:id]
|
25
|
+
error_id = "#{local_assigns[:id]}-error"
|
26
26
|
described_by = described_by.blank? ? error_id : "#{described_by} #{error_id}"
|
27
|
-
error_attributes
|
27
|
+
error_attributes = (local_assigns[:errorMessage][:attributes] || {}).merge(id: error_id)
|
28
28
|
%>
|
29
29
|
<%=
|
30
30
|
govukErrorMessage({
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<div class="govuk-date-input__item">
|
53
53
|
<%
|
54
54
|
input_mode = item[:inputmode] || "numeric"
|
55
|
-
item_id = item[:id]
|
55
|
+
item_id = item[:id] || "#{local_assigns[:id]}-#{item[:name]}"
|
56
56
|
item_classes = class_names("govuk-date-input__input", item[:classes])
|
57
57
|
name = local_assigns[:namePrefix] ? "#{local_assigns[:namePrefix]}-#{item[:name]}" : item[:name]
|
58
58
|
%>
|
@@ -76,18 +76,19 @@
|
|
76
76
|
<% end %>
|
77
77
|
<%
|
78
78
|
form_group_classes = class_names(
|
79
|
-
|
80
|
-
|
79
|
+
"govuk-form-group",
|
80
|
+
"govuk-form-group--error" => local_assigns[:errorMessage]
|
81
|
+
)
|
81
82
|
%>
|
82
83
|
<%= tag.div(class: form_group_classes) do %>
|
83
84
|
<% if local_assigns[:fieldset] %>
|
84
85
|
<%= govukFieldset({
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
describedBy: described_by,
|
87
|
+
classes: local_assigns[:fieldset].try(:[], :classes),
|
88
|
+
role: "group",
|
89
|
+
attributes: local_assigns[:fieldset].try(:[], :attributes),
|
90
|
+
legend: local_assigns[:fieldset].try(:[], :legend)
|
91
|
+
}) { date_input } %>
|
91
92
|
<% else %>
|
92
93
|
<%= date_input %>
|
93
94
|
<% end %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
}.merge!(local_assigns[:attributes] || {})
|
8
8
|
div_attributes[:data]["disable-auto-focus"] = true if local_assigns[:disableAutoFocus]
|
9
9
|
%>
|
10
|
-
<%= tag.div
|
10
|
+
<%= tag.div(**div_attributes) do %>
|
11
11
|
<h2 class="govuk-error-summary__title" id="error-summary-title">
|
12
12
|
<%= local_assigns[:titleHtml].presence || local_assigns[:titleText] %>
|
13
13
|
</h2>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
fieldset_attributes = {
|
3
3
|
class: class_names("govuk-fieldset", local_assigns[:classes])
|
4
4
|
}
|
5
|
-
fieldset_attributes
|
6
|
-
fieldset_attributes
|
5
|
+
fieldset_attributes[:role] = local_assigns[:role] if local_assigns[:role]
|
6
|
+
fieldset_attributes["aria-describedby"] = local_assigns[:describedBy] if local_assigns[:describedBy]
|
7
7
|
%>
|
8
8
|
<%= tag.fieldset(**fieldset_attributes) do %>
|
9
9
|
<% if local_assigns[:legend].present? %>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<%= tag.header(**header_attributes) do %>
|
21
21
|
<%= tag.div(class: container_classes) do %>
|
22
22
|
<div class="govuk-header__logo">
|
23
|
-
<a href="<%=local_assigns[:homepageUrl]%>" class="govuk-header__link govuk-header__link--homepage">
|
23
|
+
<a href="<%= local_assigns[:homepageUrl] %>" class="govuk-header__link govuk-header__link--homepage">
|
24
24
|
<span class="govuk-header__logotype">
|
25
25
|
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36">
|
26
26
|
<path 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 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-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>
|
@@ -35,7 +35,7 @@
|
|
35
35
|
<div class="govuk-header__content">
|
36
36
|
<% if local_assigns[:serviceName] %>
|
37
37
|
<% if local_assigns[:serviceUrl] %>
|
38
|
-
<a href="<%=local_assigns[:serviceUrl]%>" class="govuk-header__link govuk-header__link--service-name">
|
38
|
+
<a href="<%= local_assigns[:serviceUrl] %>" class="govuk-header__link govuk-header__link--service-name">
|
39
39
|
<%= local_assigns[:serviceName] %>
|
40
40
|
</a>
|
41
41
|
<% else %>
|
@@ -1,95 +1,85 @@
|
|
1
1
|
<% described_by = local_assigns[:describedBy] %>
|
2
2
|
<% form_group_classes = class_names(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
%>
|
3
|
+
"govuk-form-group",
|
4
|
+
{ "govuk-form-group--error" => local_assigns[:errorMessage] },
|
5
|
+
local_assigns.dig(:formGroup, :classes)
|
6
|
+
) %>
|
8
7
|
<div class="<%= form_group_classes %>">
|
9
|
-
<%= render(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
)
|
17
|
-
%>
|
8
|
+
<%= render("components/govuk_label",
|
9
|
+
html: local_assigns.dig(:label, :html),
|
10
|
+
text: local_assigns.dig(:label, :text),
|
11
|
+
classes: local_assigns.dig(:label, :classes),
|
12
|
+
isPageHeading: local_assigns.dig(:label, :isPageHeading),
|
13
|
+
attributes: local_assigns.dig(:label, :attributes),
|
14
|
+
for: local_assigns[:id]) %>
|
18
15
|
|
19
16
|
<% if local_assigns[:hint] %>
|
20
|
-
<% hint_id = local_assigns[:id]
|
21
|
-
<% described_by = described_by ? described_by
|
22
|
-
<%= render(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
)
|
29
|
-
%>
|
17
|
+
<% hint_id = "#{local_assigns[:id]}-hint" %>
|
18
|
+
<% described_by = described_by ? "#{described_by} #{hint_id}" : hint_id %>
|
19
|
+
<%= render("components/govuk_hint",
|
20
|
+
id: hint_id,
|
21
|
+
classes: local_assigns.dig(:hint, :classes),
|
22
|
+
attributes: local_assigns.dig(:hint, :attributes),
|
23
|
+
html: local_assigns.dig(:hint, :html),
|
24
|
+
text: local_assigns.dig(:hint, :text)) %>
|
30
25
|
<% end %>
|
31
26
|
|
32
27
|
<% if local_assigns[:errorMessage] %>
|
33
|
-
<% error_id = local_assigns[:id]
|
34
|
-
<% described_by = described_by ? described_by
|
35
|
-
<%= render(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
)
|
43
|
-
%>
|
28
|
+
<% error_id = "#{local_assigns[:id]}-error" %>
|
29
|
+
<% described_by = described_by ? "#{described_by} #{error_id}" : error_id %>
|
30
|
+
<%= render("components/govuk_error_message",
|
31
|
+
id: error_id,
|
32
|
+
classes: local_assigns.dig(:errorMessage, :classes),
|
33
|
+
attributes: local_assigns.dig(:errorMessage, :attributes),
|
34
|
+
html: local_assigns.dig(:errorMessage, :html),
|
35
|
+
text: local_assigns.dig(:errorMessage, :text),
|
36
|
+
visuallyHiddenText: local_assigns.dig(:errorMessage, :visuallyHiddenText)) %>
|
44
37
|
<% end %>
|
45
38
|
|
46
39
|
<% if local_assigns[:prefix] || local_assigns[:suffix] %><div class="govuk-input__wrapper"><% end %>
|
47
40
|
|
48
41
|
<% if local_assigns.dig(:prefix, :text) || local_assigns.dig(:prefix, :html) %>
|
49
42
|
<% prefix_attributes = {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
%>
|
43
|
+
class: class_names(
|
44
|
+
"govuk-input__prefix",
|
45
|
+
local_assigns.dig(:prefix, :classes)
|
46
|
+
),
|
47
|
+
'aria-hidden': true
|
48
|
+
}
|
49
|
+
prefix_attributes.merge!(local_assigns.dig(:prefix, :attributes)) if local_assigns.dig(:prefix, :attributes)
|
50
|
+
prefix_content = local_assigns.dig(:prefix, :html) || local_assigns.dig(:prefix, :text) %>
|
59
51
|
<%= tag.div prefix_content, **prefix_attributes %>
|
60
52
|
<% end %>
|
61
53
|
|
62
54
|
<% input_attributes = {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
%>
|
80
|
-
<%= tag.input **input_attributes %>
|
55
|
+
class: class_names(
|
56
|
+
"govuk-input",
|
57
|
+
local_assigns[:classes],
|
58
|
+
{ "govuk-input--error" => local_assigns[:errorMessage] }
|
59
|
+
),
|
60
|
+
id: local_assigns[:id],
|
61
|
+
name: local_assigns[:name],
|
62
|
+
type: local_assigns[:type] || "text"
|
63
|
+
}
|
64
|
+
input_attributes[:spellcheck] = local_assigns[:spellcheck] unless local_assigns[:spellcheck].nil?
|
65
|
+
input_attributes[:value] = local_assigns[:value] if local_assigns[:value]
|
66
|
+
input_attributes[:'aria-describedby'] = described_by if described_by.present?
|
67
|
+
input_attributes[:autocomplete] = local_assigns[:autocomplete] if local_assigns[:autocomplete]
|
68
|
+
input_attributes[:pattern] = local_assigns[:pattern] if local_assigns[:pattern]
|
69
|
+
input_attributes[:inputmode] = local_assigns[:inputmode] if local_assigns[:inputmode]
|
70
|
+
input_attributes.merge!(local_assigns[:attributes]) if local_assigns[:attributes] %>
|
71
|
+
<%= tag.input(**input_attributes) %>
|
81
72
|
|
82
73
|
<% if local_assigns.dig(:suffix, :text) || local_assigns.dig(:suffix, :html) %>
|
83
74
|
<% suffix_attributes = {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
%>
|
75
|
+
class: class_names(
|
76
|
+
"govuk-input__suffix",
|
77
|
+
local_assigns.dig(:suffix, :classes)
|
78
|
+
),
|
79
|
+
'aria-hidden': true
|
80
|
+
}
|
81
|
+
suffix_attributes.merge!(local_assigns.dig(:suffix, :attributes)) if local_assigns.dig(:suffix, :attributes)
|
82
|
+
suffix_content = local_assigns.dig(:suffix, :html) || local_assigns.dig(:suffix, :text) %>
|
93
83
|
<%= tag.div suffix_content, **suffix_attributes %>
|
94
84
|
<% end %>
|
95
85
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
}.merge!(local_assigns[:attributes].presence || {})
|
5
5
|
div_attributes[:id] = local_assigns[:id] if local_assigns[:id].present?
|
6
6
|
%>
|
7
|
-
<%= tag.div
|
7
|
+
<%= tag.div(**div_attributes) do %>
|
8
8
|
<%= local_assigns[:html] || local_assigns[:text] %>
|
9
9
|
<%= capture(&block) if block %>
|
10
10
|
<% end %>
|
@@ -2,16 +2,16 @@
|
|
2
2
|
banner_type = local_assigns[:type]&.to_s
|
3
3
|
if banner_type == "success"
|
4
4
|
success_banner = true
|
5
|
-
type_class = "govuk-notification-banner
|
5
|
+
type_class = "govuk-notification-banner--#{banner_type}"
|
6
6
|
end
|
7
7
|
|
8
8
|
role = if local_assigns[:role]
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
local_assigns[:role]
|
10
|
+
elsif success_banner
|
11
|
+
"alert"
|
12
|
+
else
|
13
|
+
"region"
|
14
|
+
end
|
15
15
|
|
16
16
|
title = if local_assigns[:titleHtml]
|
17
17
|
local_assigns[:titleHtml]
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"Important"
|
24
24
|
end
|
25
25
|
|
26
|
-
banner_classes =
|
26
|
+
banner_classes = class_names(
|
27
27
|
"govuk-notification-banner",
|
28
28
|
type_class,
|
29
29
|
local_assigns[:classes]
|
@@ -38,7 +38,7 @@
|
|
38
38
|
class: banner_classes
|
39
39
|
}.merge(local_assigns[:attributes] || {})
|
40
40
|
|
41
|
-
attributes
|
41
|
+
attributes["data-disable-auto-focus"] = true if local_assigns[:disableAutoFocus]
|
42
42
|
|
43
43
|
title_heading_level = local_assigns[:title_heading_level] ? "h#{local_assigns[:title_heading_level]}" : "h2"
|
44
44
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
}
|
49
49
|
%>
|
50
50
|
|
51
|
-
<%= tag.div
|
51
|
+
<%= tag.div(**attributes) do %>
|
52
52
|
<div class="govuk-notification-banner__header">
|
53
53
|
<%= tag.send(title_heading_level, **header_attributes) do %>
|
54
54
|
<%= title %>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</div>
|
57
57
|
<div class="govuk-notification-banner__content">
|
58
58
|
<% if local_assigns[:block] %>
|
59
|
-
<%= capture
|
59
|
+
<%= capture(&block) %>
|
60
60
|
<% elsif local_assigns[:html] %>
|
61
61
|
<%= local_assigns[:html] %>
|
62
62
|
<% elsif local_assigns[:text] %>
|