govuk_publishing_components 35.3.5 → 35.4.0
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/component_guide/audit-filter.js +81 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +4 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +5 -1
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +245 -176
- data/app/assets/stylesheets/component_guide/application.scss +16 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +0 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +0 -12
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +0 -11
- data/app/models/govuk_publishing_components/audit_applications.rb +14 -0
- data/app/models/govuk_publishing_components/audit_comparer.rb +14 -0
- data/app/models/govuk_publishing_components/audit_components.rb +34 -32
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +40 -32
- data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +56 -12
- data/app/views/govuk_publishing_components/audit/_components.html.erb +9 -7
- data/app/views/govuk_publishing_components/audit/show.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/_hint.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/_label.html.erb +6 -6
- data/app/views/govuk_publishing_components/components/docs/hint.yml +1 -1
- data/lib/generators/govuk_publishing_components/component_generator.rb +2 -2
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +8 -8
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/README.md +1 -3
- data/node_modules/axe-core/axe.js +4385 -1157
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +12 -0
- data/node_modules/axe-core/package.json +2 -1
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +3 -2
@@ -537,3 +537,19 @@ $code-delete-bg: #fadddd;
|
|
537
537
|
.component-doc__content-list {
|
538
538
|
margin-top: govuk-spacing(5);
|
539
539
|
}
|
540
|
+
|
541
|
+
.component__application-name {
|
542
|
+
display: block;
|
543
|
+
@include govuk-font($size: 16);
|
544
|
+
font-weight: normal;
|
545
|
+
}
|
546
|
+
|
547
|
+
.component__count {
|
548
|
+
&:before {
|
549
|
+
content: "(";
|
550
|
+
}
|
551
|
+
|
552
|
+
&:after {
|
553
|
+
content: ")";
|
554
|
+
}
|
555
|
+
}
|
@@ -532,10 +532,6 @@ $after-button-padding-left: govuk-spacing(4);
|
|
532
532
|
margin: 0;
|
533
533
|
padding: govuk-spacing(1) govuk-spacing(4);
|
534
534
|
|
535
|
-
@include govuk-media-query($from: "desktop") {
|
536
|
-
border-right: 0;
|
537
|
-
}
|
538
|
-
|
539
535
|
@include govuk-media-query($from: 360px) {
|
540
536
|
&:before {
|
541
537
|
@include chevron(govuk-colour("white"));
|
@@ -575,7 +571,6 @@ $after-button-padding-left: govuk-spacing(4);
|
|
575
571
|
right: 0;
|
576
572
|
|
577
573
|
@include focus-not-focus-visible {
|
578
|
-
background: $govuk-brand-colour;
|
579
574
|
border-bottom: 1px solid govuk-colour("dark-blue");
|
580
575
|
border-left: none;
|
581
576
|
position: relative;
|
@@ -62,12 +62,6 @@ $large-input-size: 50px;
|
|
62
62
|
// Double the border by adding its width again. Use `box-shadow` for this // instead of changing `border-width`
|
63
63
|
// Also, `outline` cannot be utilised here as it is already used for the yellow focus state.
|
64
64
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
65
|
-
|
66
|
-
@include govuk-if-ie8 {
|
67
|
-
// IE8 doesn't support `box-shadow` so double the border with
|
68
|
-
// `border-width`.
|
69
|
-
border-width: $govuk-border-width-form-element * 2;
|
70
|
-
}
|
71
65
|
}
|
72
66
|
|
73
67
|
.gem-c-search__input[type="search"] { // overly specific to prevent some overrides from outside
|
@@ -136,12 +130,6 @@ $large-input-size: 50px;
|
|
136
130
|
// Also, `outline` cannot be utilised
|
137
131
|
// here as it is already used for the yellow focus state.
|
138
132
|
box-shadow: inset 0 0 0 $govuk-border-width-form-element * 2 govuk-colour("black");
|
139
|
-
|
140
|
-
@include govuk-if-ie8 {
|
141
|
-
// IE8 doesn't support `box-shadow` so double the border with
|
142
|
-
// `border-width`.
|
143
|
-
border-width: $govuk-border-width-form-element * 2;
|
144
|
-
}
|
145
133
|
}
|
146
134
|
|
147
135
|
&::-moz-focus-inner {
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss
CHANGED
@@ -44,17 +44,6 @@
|
|
44
44
|
height: 140px;
|
45
45
|
background: govuk-colour("white");
|
46
46
|
outline: $govuk-border-width solid transparentize(govuk-colour("black"), .9);
|
47
|
-
|
48
|
-
@include govuk-if-ie8 {
|
49
|
-
// IE8 incorrectly asserts the "max-width: 100%" rule to be 0
|
50
|
-
// because of the collapsed width on its floating container
|
51
|
-
// Reset the max-width so that thumbnails render at the specified
|
52
|
-
// width above.
|
53
|
-
// http://www.456bereastreet.com/archive/201202/using_max-width_on_images_can_make_them_disappear_in_ie8/
|
54
|
-
max-width: none;
|
55
|
-
border: $govuk-border-width solid govuk-colour("mid-grey", $legacy: "grey-3");
|
56
|
-
}
|
57
|
-
|
58
47
|
box-shadow: 0 2px 2px rgba(govuk-colour("black"), .4);
|
59
48
|
}
|
60
49
|
|
@@ -55,6 +55,19 @@ module GovukPublishingComponents
|
|
55
55
|
components: components_in_ruby,
|
56
56
|
},
|
57
57
|
]
|
58
|
+
|
59
|
+
# applications might not have all of these things for all components
|
60
|
+
options = {
|
61
|
+
application_name: name,
|
62
|
+
templates_path: "app/views/components",
|
63
|
+
stylesheets_path: "app/assets/stylesheets/components",
|
64
|
+
javascripts_path: "app/assets/javascripts/components/",
|
65
|
+
tests_path: "spec/components/",
|
66
|
+
javascript_tests_path: "spec/javascripts/components/",
|
67
|
+
helpers_path: "app/helpers/",
|
68
|
+
}
|
69
|
+
application_components = AuditComponents.new(path, options)
|
70
|
+
application_components = application_components.data if application_components
|
58
71
|
end
|
59
72
|
|
60
73
|
@data = {
|
@@ -66,6 +79,7 @@ module GovukPublishingComponents
|
|
66
79
|
component_locations: @component_locations,
|
67
80
|
helper_references: @helper_references,
|
68
81
|
uses_individual_asset_model: @uses_individual_asset_model,
|
82
|
+
application_components: application_components || [],
|
69
83
|
}
|
70
84
|
end
|
71
85
|
|
@@ -23,6 +23,7 @@ module GovukPublishingComponents
|
|
23
23
|
@applications_data = sort_results(results)
|
24
24
|
@gem_data[:components_by_application] = get_components_by_application || []
|
25
25
|
@gem_data[:helpers_used_by_applications] = get_helpers_used_by_applications || []
|
26
|
+
@gem_data[:component_file_details] = combine_all_component_file_details(@gem_data[:component_file_details], @applications_data)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -102,6 +103,7 @@ module GovukPublishingComponents
|
|
102
103
|
component_locations: result[:component_locations],
|
103
104
|
helper_references: result[:helper_references],
|
104
105
|
uses_individual_asset_model: result[:uses_individual_asset_model],
|
106
|
+
application_components: result[:application_components],
|
105
107
|
}
|
106
108
|
else
|
107
109
|
data << {
|
@@ -314,5 +316,17 @@ module GovukPublishingComponents
|
|
314
316
|
|
315
317
|
results
|
316
318
|
end
|
319
|
+
|
320
|
+
def combine_all_component_file_details(gem_components, applications)
|
321
|
+
applications.each do |application|
|
322
|
+
next unless application[:application_components]
|
323
|
+
|
324
|
+
application[:application_components][:component_file_details].each do |component|
|
325
|
+
gem_components << component
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
gem_components.sort_by { |c| c[:name] }
|
330
|
+
end
|
317
331
|
end
|
318
332
|
end
|
@@ -2,16 +2,17 @@ module GovukPublishingComponents
|
|
2
2
|
class AuditComponents
|
3
3
|
attr_reader :data
|
4
4
|
|
5
|
-
def initialize(path)
|
5
|
+
def initialize(path, options = {})
|
6
6
|
# paths to key file locations
|
7
|
-
@templates_path = "app/views/govuk_publishing_components/components"
|
8
|
-
@stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
|
9
|
-
@print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
|
10
|
-
@javascripts_path = "app/assets/javascripts/govuk_publishing_components/components"
|
11
|
-
@tests_path = "spec/components"
|
12
|
-
@javascript_tests_path = "spec/javascripts/components"
|
13
|
-
@helpers_path = "lib/govuk_publishing_components/presenters"
|
14
|
-
|
7
|
+
@templates_path = options[:templates_path] || "app/views/govuk_publishing_components/components"
|
8
|
+
@stylesheets_path = options[:stylesheets_path] || "app/assets/stylesheets/govuk_publishing_components/components"
|
9
|
+
@print_stylesheets_path = options[:print_stylesheets_path] || "app/assets/stylesheets/govuk_publishing_components/components/print"
|
10
|
+
@javascripts_path = options[:javascripts_path] || "app/assets/javascripts/govuk_publishing_components/components"
|
11
|
+
@tests_path = options[:tests_path] || "spec/components"
|
12
|
+
@javascript_tests_path = options[:javascript_tests_path] || "spec/javascripts/components"
|
13
|
+
@helpers_path = options[:helpers_path] || "lib/govuk_publishing_components/presenters"
|
14
|
+
|
15
|
+
@application_name = options[:application_name] || "govuk_publishing_components"
|
15
16
|
@all_templates = Dir["#{path}/#{@templates_path}/*.erb"].sort
|
16
17
|
@templates_full_path = "#{path}/#{@templates_path}/"
|
17
18
|
|
@@ -28,36 +29,36 @@ module GovukPublishingComponents
|
|
28
29
|
@data = {
|
29
30
|
gem_found: false,
|
30
31
|
}
|
32
|
+
@auditing_an_application = true unless @application_name == "govuk_publishing_components"
|
31
33
|
@data = compile_data(path) if Dir.exist?(path)
|
32
34
|
end
|
33
35
|
|
34
36
|
private
|
35
37
|
|
36
38
|
def compile_data(path)
|
39
|
+
data = {}
|
40
|
+
data[:gem_found] = true unless @auditing_an_application
|
37
41
|
component_file_details = get_component_file_details(path)
|
38
|
-
helper_usage = get_helper_usage(component_file_details)
|
42
|
+
data[:helper_usage] = get_helper_usage(component_file_details) unless @auditing_an_application
|
39
43
|
|
40
44
|
# remove the template file reference as not needed
|
41
45
|
component_file_details.map { |detail| detail.delete(:template_file) }
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
component_numbers: @component_numbers,
|
49
|
-
helper_usage: helper_usage,
|
50
|
-
}
|
47
|
+
data[:component_code] = clean_files(@all_templates, @templates_full_path).sort unless @auditing_an_application
|
48
|
+
data[:component_file_details] = component_file_details
|
49
|
+
data[:component_numbers] = @component_numbers
|
50
|
+
data[:components_containing_components] = find_all_partials_in(@all_templates) unless @auditing_an_application
|
51
|
+
data
|
51
52
|
end
|
52
53
|
|
53
54
|
def get_component_file_details(path)
|
54
55
|
component_templates = clean_files(@all_templates, @templates_full_path).sort
|
55
56
|
details = []
|
56
57
|
component_templates.each do |component|
|
57
|
-
component_detail = {
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
component_detail = {}
|
59
|
+
component_detail[:name] = component
|
60
|
+
component_detail[:application] = @application_name
|
61
|
+
component_detail[:link] = get_component_link(component) unless @auditing_an_application
|
61
62
|
file_details = [
|
62
63
|
{
|
63
64
|
type: "template",
|
@@ -102,10 +103,10 @@ module GovukPublishingComponents
|
|
102
103
|
details = {}
|
103
104
|
type = detail[:type]
|
104
105
|
file = detail[:file]
|
105
|
-
details["#{type}_exists".to_sym] = false
|
106
|
-
# save the location of the template to later grep for helper use
|
107
|
-
details["#{type}_file".to_sym] = file if type == "template"
|
108
106
|
if File.file?(file)
|
107
|
+
details["#{type}_exists".to_sym] = false
|
108
|
+
# save the location of the template to later grep for helper use
|
109
|
+
details["#{type}_file".to_sym] = file if type == "template"
|
109
110
|
# we don't have separate print stylesheets anymore
|
110
111
|
# so check the main stylesheet for print styles
|
111
112
|
if type == "print_stylesheet"
|
@@ -139,8 +140,8 @@ module GovukPublishingComponents
|
|
139
140
|
.gsub(".scss", "")
|
140
141
|
.gsub(".js", "")
|
141
142
|
.gsub("spec", "")
|
143
|
+
.gsub("helper.rb", "")
|
142
144
|
.gsub(".rb", "")
|
143
|
-
.gsub("helper", "")
|
144
145
|
.strip
|
145
146
|
end
|
146
147
|
|
@@ -202,21 +203,22 @@ module GovukPublishingComponents
|
|
202
203
|
def components_within_component(file)
|
203
204
|
file = get_component_name_from_full_path(file)
|
204
205
|
file = "#{@templates_full_path}#{file}.html.erb".sub(/.*\K\//, "/_")
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
206
|
+
if File.exist?(file)
|
207
|
+
data = File.read(file)
|
208
|
+
match = data.scan(/["']{1}(govuk_publishing_components\/components\/[\/a-z_-]+["']{1})/)
|
209
|
+
match.flatten.uniq.map(&:to_s).sort.map do |m|
|
210
|
+
m.gsub("govuk_publishing_components/components/", "").tr('\"\'', "")
|
211
|
+
end
|
209
212
|
end
|
210
213
|
end
|
211
214
|
|
212
215
|
def get_asset_link(a_thing, component)
|
213
216
|
url = "https://github.com/alphagov"
|
214
|
-
repo =
|
217
|
+
repo = @application_name
|
215
218
|
blob = "blob/main"
|
216
219
|
link = nil
|
217
220
|
link = "#{url}/#{repo}/#{blob}/#{@templates_path}/_#{component.gsub(' ', '_')}.html.erb" if a_thing == "template"
|
218
221
|
link = "#{url}/#{repo}/#{blob}/#{@stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "stylesheet"
|
219
|
-
link = "#{url}/#{repo}/#{blob}/#{@print_stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "print_stylesheet"
|
220
222
|
link = "#{url}/#{repo}/#{blob}/#{@javascripts_path}/#{component.gsub(' ', '-')}.js" if a_thing == "javascript"
|
221
223
|
link = "#{url}/#{repo}/#{blob}/#{@tests_path}/#{component.gsub(' ', '_')}_spec.rb" if a_thing == "test"
|
222
224
|
link = "#{url}/#{repo}/#{blob}/#{@javascript_tests_path}/#{component.gsub(' ', '-')}-spec.js" if a_thing == "javascript_test"
|
@@ -38,23 +38,15 @@
|
|
38
38
|
|
39
39
|
<% if @other_applications %>
|
40
40
|
<% if application[:uses_individual_asset_model] %>
|
41
|
-
|
42
|
-
<
|
43
|
-
|
44
|
-
<span class="govuk-warning-text__assistive">Warning</span>
|
45
|
-
This application uses <a class="govuk-link" href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/set-up-individual-component-css-loading.md">per page asset loading</a> for components. Warnings about missing stylesheets have been suppressed.
|
46
|
-
</strong>
|
47
|
-
</div>
|
41
|
+
<%= render "govuk_publishing_components/components/warning_text", {
|
42
|
+
text: raw("This application uses <a class=\"govuk-link\" href=\"https://github.com/alphagov/govuk_publishing_components/blob/main/docs/set-up-individual-component-css-loading.md\">per page asset loading</a> for components. Warnings about missing stylesheets have been suppressed.")
|
43
|
+
} %>
|
48
44
|
<% end %>
|
49
45
|
|
50
46
|
<% if application[:uses_static] %>
|
51
|
-
|
52
|
-
<
|
53
|
-
|
54
|
-
<span class="govuk-warning-text__assistive">Warning</span>
|
55
|
-
This application uses <a href="https://github.com/alphagov/static" class="govuk-link">static</a>, which can contain assets for components used in more than one application. Warnings for missing component assets in this application that are already included in static have been suppressed.
|
56
|
-
</strong>
|
57
|
-
</div>
|
47
|
+
<%= render "govuk_publishing_components/components/warning_text", {
|
48
|
+
text: raw("This application uses <a href=\"https://github.com/alphagov/static\" class=\"govuk-link\">static</a>, which can contain assets for components used in more than one application. Warnings for missing component assets in this application that are already included in static have been suppressed.")
|
49
|
+
} %>
|
58
50
|
<% end %>
|
59
51
|
|
60
52
|
<% application[:warnings].each do |warning| %>
|
@@ -74,24 +66,28 @@
|
|
74
66
|
heading_level: 3,
|
75
67
|
} %>
|
76
68
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
Uses per page component asset loading
|
88
|
-
<% else %>
|
89
|
-
None
|
90
|
-
<% end %>
|
91
|
-
</dd>
|
92
|
-
</div>
|
69
|
+
<% items = [] %>
|
70
|
+
<% application[:summary].each do |item| %>
|
71
|
+
<% content = capture do %>
|
72
|
+
<% if item[:value].length > 0 %>
|
73
|
+
<%= item[:value].join(", ") %>
|
74
|
+
<% elsif application[:uses_individual_asset_model] && item[:name] == "In stylesheets" %>
|
75
|
+
Uses per page component asset loading
|
76
|
+
<% else %>
|
77
|
+
None
|
78
|
+
<% end %>
|
93
79
|
<% end %>
|
94
|
-
|
80
|
+
<%
|
81
|
+
items << {
|
82
|
+
field: "#{item[:name]} (#{item[:value].length})",
|
83
|
+
value: content
|
84
|
+
}
|
85
|
+
%>
|
86
|
+
<% end %>
|
87
|
+
|
88
|
+
<%= render "govuk_publishing_components/components/summary_list", {
|
89
|
+
items: items
|
90
|
+
} %>
|
95
91
|
|
96
92
|
<% if application[:gem_style_references].any? %>
|
97
93
|
<%= render "govuk_publishing_components/components/heading", {
|
@@ -127,6 +123,18 @@
|
|
127
123
|
<% end %>
|
128
124
|
</ul>
|
129
125
|
<% end %>
|
126
|
+
|
127
|
+
<% application_components = application[:application_components] %>
|
128
|
+
<% if application_components[:component_file_details].any? %>
|
129
|
+
<%= render "govuk_publishing_components/components/heading", {
|
130
|
+
text: "Application components (#{application_components[:component_file_details].length})",
|
131
|
+
font_size: "m",
|
132
|
+
margin_bottom: 4,
|
133
|
+
heading_level: 3,
|
134
|
+
} %>
|
135
|
+
<p class="govuk-body">This is a list of components found in this application. Note that some components may appear to be missing files due to inconsistencies in directory structure and naming conventions.</p>
|
136
|
+
<%= render "component_contents", passed_components: application_components, show_application_name: false %>
|
137
|
+
<% end %>
|
130
138
|
<% else %>
|
131
139
|
<p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
|
132
140
|
<% end %>
|
@@ -141,7 +149,7 @@
|
|
141
149
|
text: sanitize(summary)
|
142
150
|
},
|
143
151
|
content: {
|
144
|
-
html:
|
152
|
+
html: accordion_content
|
145
153
|
},
|
146
154
|
}
|
147
155
|
%>
|
@@ -1,23 +1,67 @@
|
|
1
|
-
<table class="govuk-table"
|
1
|
+
<table class="govuk-table" <% if show_application_name %>data-audit-list<% end %>>
|
2
2
|
<thead class="govuk-table__head">
|
3
3
|
<tr class="govuk-table__row">
|
4
4
|
<th scope="col" class="govuk-table__header sticky-table-header">Component</th>
|
5
|
-
<th scope="col" class="govuk-table__header sticky-table-header"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<th scope="col" class="govuk-table__header sticky-table-header"
|
5
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="template">
|
6
|
+
Template
|
7
|
+
<% unless show_application_name %>
|
8
|
+
<span class="component__count"><%= passed_components[:component_numbers][:template] %></span>
|
9
|
+
<% end %>
|
10
|
+
</th>
|
11
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="stylesheet">
|
12
|
+
CSS
|
13
|
+
<% unless show_application_name %>
|
14
|
+
<span class="component__count"><%= passed_components[:component_numbers][:stylesheet] %></span>
|
15
|
+
<% end %>
|
16
|
+
</th>
|
17
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="print_stylesheet">
|
18
|
+
Print styles
|
19
|
+
<% unless show_application_name %>
|
20
|
+
<span class="component__count"><%= passed_components[:component_numbers][:print_stylesheet] %></span>
|
21
|
+
<% end %>
|
22
|
+
</th>
|
23
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="javascript">
|
24
|
+
JS
|
25
|
+
<% unless show_application_name %>
|
26
|
+
<span class="component__count"><%= passed_components[:component_numbers][:javascript] %></span>
|
27
|
+
<% end %>
|
28
|
+
</th>
|
29
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="test">
|
30
|
+
Test
|
31
|
+
<% unless show_application_name %>
|
32
|
+
<span class="component__count"><%= passed_components[:component_numbers][:test] %></span>
|
33
|
+
<% end %>
|
34
|
+
</th>
|
35
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="javascript_test">
|
36
|
+
JS test
|
37
|
+
<% unless show_application_name %>
|
38
|
+
<span class="component__count"><%= passed_components[:component_numbers][:javascript_test] %></span>
|
39
|
+
<% end %>
|
40
|
+
</th>
|
41
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="helper">
|
42
|
+
Helper
|
43
|
+
<% unless show_application_name %>
|
44
|
+
<span class="component__count"><%= passed_components[:component_numbers][:helper] %></span>
|
45
|
+
<% end %>
|
46
|
+
</th>
|
12
47
|
</tr>
|
13
48
|
</thead>
|
14
49
|
<tbody class="govuk-table__body">
|
15
|
-
<%
|
16
|
-
<tr class="govuk-table__row">
|
50
|
+
<% passed_components[:component_file_details].each do |component| %>
|
51
|
+
<tr class="govuk-table__row" data-application="<%= component[:application] %>">
|
17
52
|
<th scope="row" class="govuk-table__header">
|
18
|
-
|
53
|
+
<% if component[:link] %>
|
54
|
+
<a href="<%= component[:link] %>" class="govuk-link">
|
55
|
+
<%= component[:name] %>
|
56
|
+
</a>
|
57
|
+
<% else %>
|
19
58
|
<%= component[:name] %>
|
20
|
-
|
59
|
+
<% end %>
|
60
|
+
<% if show_application_name %>
|
61
|
+
<span class="component__application-name">
|
62
|
+
<%= component[:application] %>
|
63
|
+
</span>
|
64
|
+
<% end %>
|
21
65
|
</th>
|
22
66
|
<td class="govuk-table__cell">
|
23
67
|
<% if component[:template_exists] %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @other_applications %>
|
2
2
|
<%= render "govuk_publishing_components/components/heading", {
|
3
|
-
text: "Components
|
3
|
+
text: "Components",
|
4
4
|
font_size: "l",
|
5
5
|
margin_bottom: 6,
|
6
6
|
} %>
|
@@ -10,7 +10,9 @@
|
|
10
10
|
<% component_items = [] %>
|
11
11
|
|
12
12
|
<% component_files = capture do %>
|
13
|
-
|
13
|
+
<div data-module="audit-filter">
|
14
|
+
<%= render "component_contents", passed_components: @components, show_application_name: true %>
|
15
|
+
</div>
|
14
16
|
<% end %>
|
15
17
|
|
16
18
|
<%
|
@@ -57,8 +59,8 @@
|
|
57
59
|
%>
|
58
60
|
|
59
61
|
<%= render 'items_in_applications',
|
60
|
-
heading: '
|
61
|
-
summary: 'Shows which applications use
|
62
|
+
heading: 'Gem components used by applications',
|
63
|
+
summary: 'Shows which applications use gem components',
|
62
64
|
content: @components[:components_by_application],
|
63
65
|
items: component_items
|
64
66
|
%>
|
@@ -97,10 +99,10 @@
|
|
97
99
|
<%
|
98
100
|
component_items << {
|
99
101
|
heading: {
|
100
|
-
text: "Helpers by
|
102
|
+
text: "Helpers used by gem components",
|
101
103
|
},
|
102
104
|
summary: {
|
103
|
-
text: "Shows which components use common helpers",
|
105
|
+
text: "Shows which gem components use common helpers",
|
104
106
|
},
|
105
107
|
content: {
|
106
108
|
html: helpers_by_component
|
@@ -109,7 +111,7 @@
|
|
109
111
|
%>
|
110
112
|
|
111
113
|
<%= render 'items_in_applications',
|
112
|
-
heading: '
|
114
|
+
heading: 'Gem helpers used by applications',
|
113
115
|
summary: 'Shows any applications that use helpers from the components gem',
|
114
116
|
content: @components[:helpers_used_by_applications],
|
115
117
|
items: component_items
|
@@ -1,5 +1,9 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
add_gem_component_stylesheet("table")
|
3
|
+
add_gem_component_stylesheet("select")
|
4
|
+
%>
|
2
5
|
|
6
|
+
<% content_for :title, "Component audit" %>
|
3
7
|
<%= render 'govuk_publishing_components/components/title', title: "Components audit", margin_top: 0; %>
|
4
8
|
|
5
9
|
<% applications = capture do %>
|
@@ -2,11 +2,15 @@
|
|
2
2
|
add_gem_component_stylesheet("hint")
|
3
3
|
|
4
4
|
id ||= "hint-#{SecureRandom.hex(4)}"
|
5
|
+
is_radio_label_hint ||= false
|
5
6
|
right_to_left ||= false
|
6
7
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
7
8
|
|
8
9
|
css_classes = %w( gem-c-hint govuk-hint )
|
9
|
-
css_classes <<
|
10
|
+
css_classes << "govuk-radios__hint" if is_radio_label_hint
|
11
|
+
|
12
|
+
custom_margin_bottom_class = shared_helper.get_margin_bottom if [*0..9].include?(local_assigns[:margin_bottom])
|
13
|
+
css_classes << custom_margin_bottom_class if local_assigns[:margin_bottom]
|
10
14
|
%>
|
11
15
|
|
12
16
|
<%= tag.div id: id, class: css_classes, dir: right_to_left ? "rtl" : nil do %>
|
@@ -15,9 +15,6 @@
|
|
15
15
|
css_classes << "govuk-label--s" if bold
|
16
16
|
css_classes << "govuk-radios__label" if is_radio_label
|
17
17
|
css_classes << "govuk-label--#{heading_size}" if heading_size
|
18
|
-
|
19
|
-
hint_text_css_classes = %w[govuk-hint]
|
20
|
-
hint_text_css_classes << "govuk-radios__hint" if is_radio_label
|
21
18
|
%>
|
22
19
|
|
23
20
|
<% if is_page_heading %>
|
@@ -29,7 +26,10 @@
|
|
29
26
|
<% end %>
|
30
27
|
|
31
28
|
<% if hint_text.present? %>
|
32
|
-
<%=
|
33
|
-
|
34
|
-
|
29
|
+
<%= render "govuk_publishing_components/components/hint", {
|
30
|
+
id: hint_id,
|
31
|
+
text: hint_text,
|
32
|
+
right_to_left: right_to_left ? "rtl" : nil,
|
33
|
+
is_radio_label_hint: is_radio_label
|
34
|
+
} %>
|
35
35
|
<% end %>
|
@@ -15,7 +15,7 @@ examples:
|
|
15
15
|
data:
|
16
16
|
text: "It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’."
|
17
17
|
with_margin_bottom:
|
18
|
-
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale).
|
18
|
+
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale).
|
19
19
|
data:
|
20
20
|
text: "You qualify if you were born in the UK before June 1960."
|
21
21
|
margin_bottom: 9
|
@@ -18,8 +18,8 @@ module GovukPublishingComponents
|
|
18
18
|
create_directory_if_not_exists(docs_dir)
|
19
19
|
create_directory_if_not_exists(scss_dir)
|
20
20
|
|
21
|
-
template "_component.html.erb", "#{template_dir}_#{@public_name}.html.erb"
|
22
|
-
template "component.yml.erb", "#{docs_dir}#{@public_name}.yml"
|
21
|
+
template "_component.html.erb", "#{template_dir}_#{@public_name.gsub('-', '_')}.html.erb"
|
22
|
+
template "component.yml.erb", "#{docs_dir}#{@public_name.gsub('-', '_')}.yml"
|
23
23
|
template "_component.scss", "#{scss_dir}_#{@public_name}.scss"
|
24
24
|
end
|
25
25
|
|
@@ -12,9 +12,6 @@ module GovukPublishingComponents
|
|
12
12
|
world_locations
|
13
13
|
statistical_data_sets
|
14
14
|
].freeze
|
15
|
-
WORLD_LOCATION_SPECIAL_CASES = {
|
16
|
-
"UK Mission to the European Union" => "uk-mission-to-the-eu",
|
17
|
-
}.freeze
|
18
15
|
|
19
16
|
attr_reader :related_navigation, :index_section_count
|
20
17
|
|
@@ -127,11 +124,14 @@ module GovukPublishingComponents
|
|
127
124
|
end
|
128
125
|
|
129
126
|
def related_world_locations
|
130
|
-
content_item_links_for("world_locations")
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
127
|
+
content_item_links_for("world_locations").each do |link|
|
128
|
+
build_world_locations_path_for link
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def build_world_locations_path_for(link)
|
133
|
+
slug = link[:text].parameterize
|
134
|
+
link[:path] ||= "/world/#{slug}/news"
|
135
135
|
end
|
136
136
|
|
137
137
|
def related_statistical_data_sets
|
@@ -14,14 +14,12 @@ Axe is an accessibility testing engine for websites and other HTML-based user in
|
|
14
14
|
|
15
15
|
## The Accessibility Rules
|
16
16
|
|
17
|
-
Axe-core has different types of rules, for WCAG 2.0
|
17
|
+
Axe-core has different types of rules, for WCAG 2.0, 2.1, 2.2 on level A, AA and AAA as well as a number of best practices that help you identify common accessibility practices like ensuring every page has an `h1` heading, and to help you avoid "gotchas" in ARIA like where an ARIA attribute you used will get ignored. The complete list of rules, grouped WCAG level and best practice, can found in [doc/rule-descriptions.md](./doc/rule-descriptions.md).
|
18
18
|
|
19
19
|
With axe-core, you can find **on average 57% of WCAG issues automatically**. Additionally, axe-core will return elements as "incomplete" where axe-core could not be certain, and manual review is needed.
|
20
20
|
|
21
21
|
To catch bugs earlier in the development cycle we recommend using the [axe-linter vscode extension](https://marketplace.visualstudio.com/items?itemName=deque-systems.vscode-axe-linter). To improve test coverage even further we recommend the [intelligent guided tests](https://www.youtube.com/watch?v=AtsX0dPCG_4&feature=youtu.be&ab_channel=DequeSystems) in the [axe Extension](https://www.deque.com/axe/browser-extensions/).
|
22
22
|
|
23
|
-
The complete list of rules, grouped WCAG level and best practice, can found in [doc/rule-descriptions.md](./doc/rule-descriptions.md).
|
24
|
-
|
25
23
|
## Getting started
|
26
24
|
|
27
25
|
First download the package:
|