govuk_publishing_components 24.1.1 → 24.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +28 -0
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +52 -8
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +26 -6
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/show-password.js +7 -2
- data/app/assets/stylesheets/component_guide/application.scss +0 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +11 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +11 -84
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +17 -13
- data/app/models/govuk_publishing_components/audit_applications.rb +1 -1
- data/app/models/govuk_publishing_components/audit_comparer.rb +2 -2
- data/app/models/govuk_publishing_components/component_example.rb +4 -3
- data/app/views/govuk_publishing_components/audit/show.html.erb +211 -199
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +8 -5
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +50 -39
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_show_password.html.erb +6 -4
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_taxonomy_list.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +29 -0
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +22 -0
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +9 -0
- data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/radio.yml +14 -1
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +2 -2
- data/config/locales/en.yml +7 -5
- data/lib/govuk_publishing_components/app_helpers/table_helper.rb +2 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/html_publication_schema.rb +1 -7
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -2
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +2 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/tasks/govuk_publishing_components_tasks.rake +1 -1
- metadata +7 -7
@@ -22,7 +22,7 @@ module GovukPublishingComponents
|
|
22
22
|
@find_all_print_stylesheets = /@import ["']{1}govuk_publishing_components\/all_components_print/
|
23
23
|
find_print_stylesheets = /(?<=@import ["']{1}govuk_publishing_components\/components\/print\/)[a-zA-Z_-]+(?=['"])/
|
24
24
|
|
25
|
-
@find_all_javascripts = /\/\/
|
25
|
+
@find_all_javascripts = /\/\/ *= require govuk_publishing_components\/all_components/
|
26
26
|
find_javascripts = /(?<=require govuk_publishing_components\/components\/)[a-zA-Z_-]+/
|
27
27
|
|
28
28
|
components_in_templates = find_components(templates, find_components, "templates") || []
|
@@ -110,8 +110,8 @@ module GovukPublishingComponents
|
|
110
110
|
next if second[:components].include?("all")
|
111
111
|
|
112
112
|
in_current.each do |component|
|
113
|
-
if @gem_data.include?("component_#{second_location}".to_sym)
|
114
|
-
warnings << create_warning(component, "Included in #{first_location} but not #{second_location}")
|
113
|
+
if @gem_data.include?("component_#{second_location}".to_sym) && @gem_data["component_#{second_location}".to_sym].include?(component)
|
114
|
+
warnings << create_warning(component, "Included in #{first_location} but not #{second_location}")
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -57,13 +57,14 @@ module GovukPublishingComponents
|
|
57
57
|
# Safe HTML can be passed to components, simulate
|
58
58
|
# by marking any string that comes from YAML as safe
|
59
59
|
def html_safe_strings(obj)
|
60
|
-
|
60
|
+
case obj
|
61
|
+
when String
|
61
62
|
obj.html_safe
|
62
|
-
|
63
|
+
when Hash
|
63
64
|
obj.each do |key, value|
|
64
65
|
obj[key] = html_safe_strings(value)
|
65
66
|
end
|
66
|
-
|
67
|
+
when Array
|
67
68
|
obj.map! { |e| html_safe_strings(e) }
|
68
69
|
else
|
69
70
|
obj
|
@@ -39,98 +39,105 @@
|
|
39
39
|
</div>
|
40
40
|
</details>
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
<h2 class="gem-c-accordion__section-heading">
|
47
|
-
<span class="gem-c-accordion__section-button" id="accordion-with-summary-sections-heading-<%= index %>">
|
48
|
-
<%= application[:name] %>
|
49
|
-
</span>
|
50
|
-
</h2>
|
51
|
-
<div class="gem-c-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-<%= index %>">
|
52
|
-
<% if application[:application_found] %>
|
53
|
-
Warnings:
|
54
|
-
<% if application[:warning_count] > 0 %>
|
55
|
-
<strong class="govuk-tag govuk-tag--red"><%= application[:warning_count] %></strong>
|
56
|
-
<% else %>
|
57
|
-
<%= application[:warning_count] %>
|
58
|
-
<% end %>
|
59
|
-
<% else %>
|
60
|
-
<strong class="govuk-tag govuk-tag--red">Application not found</strong>
|
61
|
-
<% end %>
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
<div id="accordion-with-summary-sections-content-<%= index %>" class="gem-c-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-<%= index %>">
|
65
|
-
<% if application[:application_found] %>
|
66
|
-
<% application[:warnings].each do |warning| %>
|
67
|
-
<p class="govuk-body">
|
68
|
-
<strong class="govuk-tag">Warn</strong>
|
69
|
-
<strong><%= warning[:component] %></strong> - <%= warning[:message] %>
|
70
|
-
</p>
|
71
|
-
<% end %>
|
42
|
+
<% #application_items = [] %>
|
43
|
+
<% application_items = @applications.map do |application| %>
|
44
|
+
<%
|
45
|
+
summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
|
72
46
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
47
|
+
if application[:application_found]
|
48
|
+
summary = "Warnings: 0"
|
49
|
+
if application[:warning_count] > 0
|
50
|
+
summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
%>
|
79
54
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<%= item[:value] %>
|
89
|
-
<% else %>
|
90
|
-
None
|
91
|
-
<% end %>
|
92
|
-
</dd>
|
93
|
-
</div>
|
94
|
-
<% end %>
|
95
|
-
</dl>
|
55
|
+
<% accordion_content = capture do %>
|
56
|
+
<% if application[:application_found] %>
|
57
|
+
<% application[:warnings].each do |warning| %>
|
58
|
+
<p class="govuk-body">
|
59
|
+
<strong class="govuk-tag">Warn</strong>
|
60
|
+
<strong><%= warning[:component] %></strong> - <%= warning[:message] %>
|
61
|
+
</p>
|
62
|
+
<% end %>
|
96
63
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
} %>
|
64
|
+
<%= render "govuk_publishing_components/components/heading", {
|
65
|
+
text: "Components used",
|
66
|
+
font_size: "m",
|
67
|
+
margin_bottom: 4,
|
68
|
+
heading_level: 3,
|
69
|
+
} %>
|
104
70
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
71
|
+
<dl class="govuk-summary-list">
|
72
|
+
<% application[:summary].each do |item| %>
|
73
|
+
<div class="govuk-summary-list__row">
|
74
|
+
<dt class="govuk-summary-list__key">
|
75
|
+
<%= item[:name] %>
|
76
|
+
</dt>
|
77
|
+
<dd class="govuk-summary-list__value">
|
78
|
+
<% if item[:value].length > 0 %>
|
79
|
+
<%= item[:value] %>
|
80
|
+
<% else %>
|
81
|
+
None
|
109
82
|
<% end %>
|
110
|
-
</
|
83
|
+
</dd>
|
84
|
+
</div>
|
85
|
+
<% end %>
|
86
|
+
</dl>
|
87
|
+
|
88
|
+
<% if application[:gem_style_references].any? %>
|
89
|
+
<%= render "govuk_publishing_components/components/heading", {
|
90
|
+
text: "Component references",
|
91
|
+
font_size: "m",
|
92
|
+
margin_bottom: 4,
|
93
|
+
heading_level: 3,
|
94
|
+
} %>
|
95
|
+
|
96
|
+
<p class="govuk-body">This shows instances of `gem-c-` classes found in the application. If a reference is found in a stylesheet or in code a warning is created, as this could be a style override or hard coded component markup.</p>
|
97
|
+
<ul class="govuk-list govuk-list--bullet">
|
98
|
+
<% application[:gem_style_references].each do |ref| %>
|
99
|
+
<li><%= ref %></li>
|
111
100
|
<% end %>
|
101
|
+
</ul>
|
102
|
+
<% end %>
|
112
103
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
<% end %>
|
125
|
-
</ul>
|
104
|
+
<% if application[:jquery_references].any? %>
|
105
|
+
<%= render "govuk_publishing_components/components/heading", {
|
106
|
+
text: "jQuery references",
|
107
|
+
font_size: "m",
|
108
|
+
margin_bottom: 4,
|
109
|
+
heading_level: 3,
|
110
|
+
} %>
|
111
|
+
<p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
|
112
|
+
<ul class="govuk-list govuk-list--bullet">
|
113
|
+
<% application[:jquery_references].each do |ref| %>
|
114
|
+
<li><%= ref %></li>
|
126
115
|
<% end %>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
116
|
+
</ul>
|
117
|
+
<% end %>
|
118
|
+
<% else %>
|
119
|
+
<p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
|
120
|
+
<% end %>
|
132
121
|
<% end %>
|
133
|
-
|
122
|
+
|
123
|
+
<%
|
124
|
+
{
|
125
|
+
heading: {
|
126
|
+
text: application[:name]
|
127
|
+
},
|
128
|
+
summary: {
|
129
|
+
text: sanitize(summary)
|
130
|
+
},
|
131
|
+
content: {
|
132
|
+
html: sanitize(accordion_content)
|
133
|
+
},
|
134
|
+
}
|
135
|
+
%>
|
136
|
+
<% end %>
|
137
|
+
|
138
|
+
<%= render "govuk_publishing_components/components/accordion", {
|
139
|
+
items: application_items
|
140
|
+
} %>
|
134
141
|
<% else %>
|
135
142
|
<p class="govuk-body">No applications found.</p>
|
136
143
|
<% end %>
|
@@ -144,125 +151,130 @@
|
|
144
151
|
} %>
|
145
152
|
|
146
153
|
<% if @components.any? %>
|
147
|
-
|
148
|
-
<
|
149
|
-
<
|
150
|
-
<
|
151
|
-
<
|
152
|
-
|
153
|
-
</
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
</
|
158
|
-
</
|
159
|
-
<
|
160
|
-
|
161
|
-
<
|
162
|
-
<
|
163
|
-
<
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
</
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
<
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
<
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
<
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
<% end %>
|
196
|
-
</td>
|
197
|
-
<td class="govuk-table__cell">
|
198
|
-
<% if component[:js_tests] %>
|
199
|
-
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
200
|
-
<% end %>
|
201
|
-
</td>
|
202
|
-
</tr>
|
203
|
-
<% end %>
|
204
|
-
</tbody>
|
205
|
-
</table>
|
206
|
-
</div>
|
207
|
-
</div>
|
154
|
+
<% component_files = capture do %>
|
155
|
+
<table class="govuk-table">
|
156
|
+
<thead class="govuk-table__head">
|
157
|
+
<tr class="govuk-table__row">
|
158
|
+
<th scope="col" class="govuk-table__header sticky-table-header">Component</th>
|
159
|
+
<th scope="col" class="govuk-table__header sticky-table-header">Stylesheet</th>
|
160
|
+
<th scope="col" class="govuk-table__header sticky-table-header">Print stylesheet</th>
|
161
|
+
<th scope="col" class="govuk-table__header sticky-table-header">JS</th>
|
162
|
+
<th scope="col" class="govuk-table__header sticky-table-header">Test</th>
|
163
|
+
<th scope="col" class="govuk-table__header sticky-table-header">JS test</th>
|
164
|
+
</tr>
|
165
|
+
</thead>
|
166
|
+
<tbody class="govuk-table__body">
|
167
|
+
<% @components[:component_listing].each do |component| %>
|
168
|
+
<tr class="govuk-table__row">
|
169
|
+
<th scope="row" class="govuk-table__header">
|
170
|
+
<a href="<%= component[:link] %>" class="govuk-link"><%= component[:name] %></a>
|
171
|
+
</th>
|
172
|
+
<td class="govuk-table__cell">
|
173
|
+
<% if component[:stylesheet] %>
|
174
|
+
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
175
|
+
<% end %>
|
176
|
+
</td>
|
177
|
+
<td class="govuk-table__cell">
|
178
|
+
<% if component[:print_stylesheet] %>
|
179
|
+
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
180
|
+
<% end %>
|
181
|
+
</td>
|
182
|
+
<td class="govuk-table__cell">
|
183
|
+
<% if component[:javascript] %>
|
184
|
+
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
185
|
+
<% end %>
|
186
|
+
</td>
|
187
|
+
<td class="govuk-table__cell">
|
188
|
+
<% if component[:tests] %>
|
189
|
+
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
190
|
+
<% end %>
|
191
|
+
</td>
|
192
|
+
<td class="govuk-table__cell">
|
193
|
+
<% if component[:js_tests] %>
|
194
|
+
<strong class="govuk-tag govuk-tag--green">Yes</strong>
|
195
|
+
<% end %>
|
196
|
+
</td>
|
197
|
+
</tr>
|
198
|
+
<% end %>
|
199
|
+
</tbody>
|
200
|
+
</table>
|
201
|
+
<% end %>
|
208
202
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
</div>
|
220
|
-
<div id="accordion-default-content-2" class="gem-c-accordion__section-content" aria-labelledby="accordion-default-heading-2">
|
221
|
-
<dl class="govuk-summary-list">
|
222
|
-
<% @components[:components_containing_components].each do |component| %>
|
223
|
-
<div class="govuk-summary-list__row">
|
224
|
-
<dt class="govuk-summary-list__key">
|
225
|
-
<a href="<%= component[:link] %>" class="govuk-link"><%= component[:component] %></a>
|
226
|
-
</dt>
|
227
|
-
<dd class="govuk-summary-list__value">
|
228
|
-
<%= component[:sub_components].join(', ') %>
|
229
|
-
</dd>
|
230
|
-
</div>
|
231
|
-
<% end %>
|
232
|
-
</dl>
|
233
|
-
</div>
|
234
|
-
</div>
|
235
|
-
<div class="gem-c-accordion__section ">
|
236
|
-
<div class="gem-c-accordion__section-header">
|
237
|
-
<h2 class="gem-c-accordion__section-heading">
|
238
|
-
<span class="gem-c-accordion__section-button" id="accordion-default-heading-2">
|
239
|
-
Components by application
|
240
|
-
</span>
|
241
|
-
</h2>
|
242
|
-
<div class="gem-c-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-2">
|
243
|
-
Shows which applications use each component
|
203
|
+
<% components_within_components = capture do %>
|
204
|
+
<dl class="govuk-summary-list">
|
205
|
+
<% @components[:components_containing_components].each do |component| %>
|
206
|
+
<div class="govuk-summary-list__row">
|
207
|
+
<dt class="govuk-summary-list__key">
|
208
|
+
<a href="<%= component[:link] %>" class="govuk-link"><%= component[:component] %></a>
|
209
|
+
</dt>
|
210
|
+
<dd class="govuk-summary-list__value">
|
211
|
+
<%= component[:sub_components].join(', ') %>
|
212
|
+
</dd>
|
244
213
|
</div>
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
<p class="govuk-body">Sorry, no applications found.</p>
|
214
|
+
<% end %>
|
215
|
+
</dl>
|
216
|
+
<% end %>
|
217
|
+
|
218
|
+
<% components_by_application = capture do %>
|
219
|
+
<% if @components[:components_by_application].any? %>
|
220
|
+
<dl class="govuk-summary-list">
|
221
|
+
<% @components[:components_by_application].each do |component| %>
|
222
|
+
<div class="govuk-summary-list__row">
|
223
|
+
<dt class="govuk-summary-list__key">
|
224
|
+
<%= component[:component] %> (<%= component[:count] %>)
|
225
|
+
</dt>
|
226
|
+
<dd class="govuk-summary-list__value">
|
227
|
+
<%= component[:list] %>
|
228
|
+
</dd>
|
229
|
+
</div>
|
262
230
|
<% end %>
|
263
|
-
</
|
264
|
-
|
265
|
-
|
231
|
+
</dl>
|
232
|
+
<% else %>
|
233
|
+
<p class="govuk-body">Sorry, no applications found.</p>
|
234
|
+
<% end %>
|
235
|
+
<% end %>
|
236
|
+
|
237
|
+
<%
|
238
|
+
component_items = [
|
239
|
+
{
|
240
|
+
heading: {
|
241
|
+
text: "Component files",
|
242
|
+
},
|
243
|
+
summary: {
|
244
|
+
text: "Lists what files each component has",
|
245
|
+
},
|
246
|
+
content: {
|
247
|
+
html: component_files
|
248
|
+
},
|
249
|
+
},
|
250
|
+
{
|
251
|
+
heading: {
|
252
|
+
text: "Components containing other components",
|
253
|
+
},
|
254
|
+
summary: {
|
255
|
+
text: "Shows which components contain other components",
|
256
|
+
},
|
257
|
+
content: {
|
258
|
+
html: components_within_components
|
259
|
+
},
|
260
|
+
},
|
261
|
+
{
|
262
|
+
heading: {
|
263
|
+
text: "Components by application",
|
264
|
+
},
|
265
|
+
summary: {
|
266
|
+
text: "Shows which applications use each component",
|
267
|
+
},
|
268
|
+
content: {
|
269
|
+
html: components_by_application
|
270
|
+
},
|
271
|
+
},
|
272
|
+
]
|
273
|
+
%>
|
274
|
+
|
275
|
+
<%= render "govuk_publishing_components/components/accordion", {
|
276
|
+
items: component_items
|
277
|
+
} %>
|
266
278
|
<% else %>
|
267
279
|
<p class="govuk-body">No components found.</p>
|
268
280
|
<% end %>
|