govuk_publishing_components 21.60.0 → 21.62.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/govuk_publishing_components/components/checkboxes.js +102 -73
- data/app/assets/javascripts/govuk_publishing_components/ie.js +2 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js +4 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/json2.js +487 -0
- data/app/assets/stylesheets/component_guide/application.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +8 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +87 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +46 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +4 -2
- data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +8 -0
- data/app/models/govuk_publishing_components/audit_applications.rb +35 -23
- data/app/models/govuk_publishing_components/audit_comparer.rb +13 -0
- data/app/models/govuk_publishing_components/audit_components.rb +1 -1
- data/app/models/govuk_publishing_components/component_example.rb +4 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +32 -3
- data/app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +32 -21
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +76 -0
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +39 -51
- data/app/views/govuk_publishing_components/components/_search.html.erb +10 -5
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +9 -9
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +45 -0
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +13 -1
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +5 -1
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +29 -0
- data/app/views/govuk_publishing_components/components/docs/layout_header.yml +34 -0
- data/app/views/govuk_publishing_components/components/docs/search.yml +6 -0
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +23 -0
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +17 -0
- data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +9 -0
- data/config/initializers/assets.rb +8 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +1 -0
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +3 -2
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +380 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/govuk/all.js +160 -57
- data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +0 -4
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +16 -8
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -5
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +68 -21
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +0 -27
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +2 -2
- data/node_modules/govuk-frontend/govuk/components/hint/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +4 -2
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +2 -2
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +33 -33
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -1
- data/node_modules/govuk-frontend/package.json +1 -1
- metadata +12 -2
@@ -44,6 +44,7 @@
|
|
44
44
|
@import "components/label";
|
45
45
|
@import "components/layout-footer";
|
46
46
|
@import "components/layout-for-admin";
|
47
|
+
@import "components/layout-for-public";
|
47
48
|
@import "components/layout-header";
|
48
49
|
@import "components/lead-paragraph";
|
49
50
|
@import "components/metadata";
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@import "govuk_publishing_components/components/search";
|
2
|
+
@import "govuk_publishing_components/components/skip-link";
|
1
3
|
@import "govuk/components/header/header";
|
2
4
|
@import "govuk/components/tag/tag";
|
3
5
|
|
@@ -18,8 +20,80 @@
|
|
18
20
|
border-bottom-color: govuk-colour("dark-grey", $legacy: "grey-1");
|
19
21
|
}
|
20
22
|
|
23
|
+
.gem-c-layout-header--no-bottom-border,
|
24
|
+
.gem-c-layout-header--no-bottom-border .govuk-header__container {
|
25
|
+
margin-bottom: 0;
|
26
|
+
border-bottom: 0;
|
27
|
+
|
28
|
+
@include govuk-media-query($until: tablet) {
|
29
|
+
padding-bottom: govuk-spacing(1);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
.gem-c-layout-header--search-left {
|
34
|
+
.gem-c-header__menu-button {
|
35
|
+
margin-top: - govuk-spacing(7);
|
36
|
+
left: 0;
|
37
|
+
}
|
38
|
+
|
39
|
+
.gem-c-header__nav-wrapper {
|
40
|
+
position: relative;
|
41
|
+
padding-left: 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
.govuk-header__navigation--end {
|
45
|
+
padding-top: 0;
|
46
|
+
text-align: left;
|
47
|
+
}
|
48
|
+
|
49
|
+
.gem-c-layout-header__search {
|
50
|
+
margin-bottom: govuk-spacing(2);
|
51
|
+
padding-bottom: govuk-spacing(5);
|
52
|
+
}
|
53
|
+
|
54
|
+
.gem-c-header__content {
|
55
|
+
position: relative;
|
56
|
+
width: 100%;
|
57
|
+
padding-bottom: govuk-spacing(2);
|
58
|
+
}
|
59
|
+
|
60
|
+
@include govuk-media-query($from: desktop) {
|
61
|
+
.gem-c-layout-header__search {
|
62
|
+
padding-bottom: govuk-spacing(1);
|
63
|
+
}
|
64
|
+
|
65
|
+
.govuk-header__navigation-item {
|
66
|
+
padding: 0 0 govuk-spacing(1) 0;
|
67
|
+
}
|
68
|
+
|
69
|
+
.gem-c-header__logo {
|
70
|
+
margin-top: 0;
|
71
|
+
}
|
72
|
+
|
73
|
+
.gem-c-header__content {
|
74
|
+
@include govuk-grid-column(two-thirds);
|
75
|
+
padding-left: govuk-spacing(6);
|
76
|
+
padding-right: govuk-spacing(1);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.gem-c-layout-header__logo,
|
82
|
+
.gem-c-layout-header__search {
|
83
|
+
padding: 0;
|
84
|
+
|
85
|
+
@include govuk-media-query($until: "tablet") {
|
86
|
+
margin-bottom: govuk-spacing(3);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
21
90
|
.gem-c-header__logo {
|
22
|
-
|
91
|
+
margin-top: govuk-spacing(1);
|
92
|
+
margin-bottom: govuk-spacing(3);
|
93
|
+
|
94
|
+
@include govuk-media-query($from: desktop) {
|
95
|
+
white-space: nowrap;
|
96
|
+
}
|
23
97
|
}
|
24
98
|
|
25
99
|
.gem-c-header__content {
|
@@ -68,3 +142,15 @@
|
|
68
142
|
display: none;
|
69
143
|
}
|
70
144
|
}
|
145
|
+
|
146
|
+
.gem-c-layout-header__search-form {
|
147
|
+
display: none;
|
148
|
+
|
149
|
+
&.js-visible {
|
150
|
+
display: block;
|
151
|
+
}
|
152
|
+
|
153
|
+
@include govuk-media-query($from: tablet) {
|
154
|
+
display: block;
|
155
|
+
}
|
156
|
+
}
|
@@ -179,6 +179,12 @@ $large-input-size: 50px;
|
|
179
179
|
}
|
180
180
|
}
|
181
181
|
|
182
|
+
.gem-c-search--no-border {
|
183
|
+
.gem-c-search__input[type="search"] {
|
184
|
+
border: 0;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
182
188
|
.gem-c-search--large {
|
183
189
|
.gem-c-search__label {
|
184
190
|
@include govuk-font($size: 19, $line-height: $large-input-size);
|
@@ -208,3 +214,43 @@ $large-input-size: 50px;
|
|
208
214
|
padding-left: 0;
|
209
215
|
}
|
210
216
|
}
|
217
|
+
|
218
|
+
.search-toggle {
|
219
|
+
background-color: govuk-colour("blue");
|
220
|
+
background-image: image-url("govuk_publishing_components/search-button.png");
|
221
|
+
background-position: 0 50%;
|
222
|
+
background-repeat: no-repeat;
|
223
|
+
display: block;
|
224
|
+
float: right;
|
225
|
+
height: 30px;
|
226
|
+
margin: -46px 0;
|
227
|
+
overflow: hidden;
|
228
|
+
padding: 0;
|
229
|
+
text-indent: -5000px;
|
230
|
+
width: 36px;
|
231
|
+
|
232
|
+
&:focus {
|
233
|
+
border-width: 0;
|
234
|
+
box-shadow: inset 0 0 0 4px $govuk-input-border-colour;
|
235
|
+
outline: $govuk-focus-width solid $govuk-focus-colour;
|
236
|
+
outline-offset: 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
&:focus,
|
240
|
+
&:hover {
|
241
|
+
background-color: lighten(govuk-colour("blue"), 5%);
|
242
|
+
}
|
243
|
+
|
244
|
+
&.js-hidden {
|
245
|
+
display: none;
|
246
|
+
}
|
247
|
+
|
248
|
+
@include govuk-device-pixel-ratio {
|
249
|
+
background-size: 52.5px 35px;
|
250
|
+
background-position: 100% 50%;
|
251
|
+
}
|
252
|
+
|
253
|
+
@include govuk-media-query($from: tablet) {
|
254
|
+
display: none;
|
255
|
+
}
|
256
|
+
}
|
@@ -29,8 +29,9 @@
|
|
29
29
|
$chart-border: govuk-colour("white"); // Chart border colour
|
30
30
|
$key-border: govuk-colour("white"); // Key border colour
|
31
31
|
$bar-colours: govuk-colour("blue"), govuk-colour("turquoise"), govuk-colour("green"), govuk-colour("light-green"), govuk-colour("yellow"), govuk-colour("orange"), govuk-colour("red"), govuk-colour("bright-purple", $legacy: "bright-red");
|
32
|
-
$bar-
|
33
|
-
$bar-
|
32
|
+
$bar-text-colours: govuk-colour("white"), govuk-colour("black"), govuk-colour("white"), govuk-colour("black"), govuk-colour("black"), govuk-colour("black"), govuk-colour("white"), govuk-colour("white");
|
33
|
+
$bar-cell-colour: govuk-colour("black");
|
34
|
+
$bar-outdented-colour: govuk-colour("black");
|
34
35
|
|
35
36
|
// CHART STYLES
|
36
37
|
.mc-chart {
|
@@ -140,6 +141,7 @@
|
|
140
141
|
@for $i from 0 to length($bar-colours) {
|
141
142
|
.mc-bar-#{$i + 1} {
|
142
143
|
background-color: nth($bar-colours, $i + 1);
|
144
|
+
color: nth($bar-text-colours, $i + 1);
|
143
145
|
}
|
144
146
|
}
|
145
147
|
|
@@ -3,37 +3,39 @@ module GovukPublishingComponents
|
|
3
3
|
attr_reader :data
|
4
4
|
|
5
5
|
def initialize(path, name)
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
@path = path
|
7
|
+
application_found = application_exists(path)
|
8
|
+
components_found = []
|
9
|
+
@gem_style_references = []
|
9
10
|
|
10
|
-
|
11
|
+
if application_found
|
12
|
+
templates = Dir["#{path}/app/views/**/*.erb"]
|
13
|
+
stylesheets = Dir["#{path}/app/assets/stylesheets/**/*.scss"]
|
14
|
+
javascripts = Dir["#{path}/app/assets/javascripts/**/*.js"]
|
11
15
|
|
12
|
-
|
13
|
-
find_stylesheets = /(?<=@import ["']{1}govuk_publishing_components\/components\/)(?!print\/)+[a-zA-Z_-]+(?=['"])/
|
16
|
+
find_components = /(?<=govuk_publishing_components\/components\/)[\/a-zA-Z_-]+(?=['"])/
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
@find_all_stylesheets = /@import ["']{1}govuk_publishing_components\/all_components/
|
19
|
+
find_stylesheets = /(?<=@import ["']{1}govuk_publishing_components\/components\/)(?!print\/)+[a-zA-Z_-]+(?=['"])/
|
17
20
|
|
18
|
-
|
19
|
-
|
21
|
+
@find_all_print_stylesheets = /@import ["']{1}govuk_publishing_components\/all_components_print/
|
22
|
+
find_print_stylesheets = /(?<=@import ["']{1}govuk_publishing_components\/components\/print\/)[a-zA-Z_-]+(?=['"])/
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
components_in_print_stylesheets = find_components(stylesheets, find_print_stylesheets, "print_stylesheets") || []
|
24
|
-
components_in_javascripts = find_components(javascripts, find_javascripts, "javascripts") || []
|
24
|
+
@find_all_javascripts = /\/\/[ ]*= require govuk_publishing_components\/all_components/
|
25
|
+
find_javascripts = /(?<=require govuk_publishing_components\/components\/)[a-zA-Z_-]+/
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
components_in_ruby = components_in_ruby.flatten.uniq
|
27
|
+
components_in_templates = find_components(templates, find_components, "templates") || []
|
28
|
+
components_in_stylesheets = find_components(stylesheets, find_stylesheets, "stylesheets") || []
|
29
|
+
components_in_print_stylesheets = find_components(stylesheets, find_print_stylesheets, "print_stylesheets") || []
|
30
|
+
components_in_javascripts = find_components(javascripts, find_javascripts, "javascripts") || []
|
32
31
|
|
33
|
-
|
34
|
-
|
32
|
+
ruby_paths = %w[/app/helpers/ /app/presenters/ /lib/]
|
33
|
+
components_in_ruby = []
|
34
|
+
ruby_paths.each do |ruby_path|
|
35
|
+
components_in_ruby << find_components(Dir["#{path}#{ruby_path}**/*.{rb,erb}"], find_components, "ruby") || []
|
36
|
+
end
|
37
|
+
components_in_ruby = components_in_ruby.flatten.uniq
|
35
38
|
|
36
|
-
if application_found
|
37
39
|
components_found = [
|
38
40
|
{
|
39
41
|
location: "templates",
|
@@ -62,6 +64,7 @@ module GovukPublishingComponents
|
|
62
64
|
name: name,
|
63
65
|
application_found: application_found,
|
64
66
|
components_found: components_found,
|
67
|
+
gem_style_references: @gem_style_references.flatten.uniq.sort,
|
65
68
|
}
|
66
69
|
end
|
67
70
|
|
@@ -73,6 +76,8 @@ module GovukPublishingComponents
|
|
73
76
|
files.each do |file|
|
74
77
|
src = File.read(file)
|
75
78
|
components_found << find_match(find, src, type)
|
79
|
+
gem_references = find_gem_references(file, src)
|
80
|
+
@gem_style_references << gem_references if gem_references
|
76
81
|
rescue StandardError
|
77
82
|
puts "File #{file} not found"
|
78
83
|
end
|
@@ -94,6 +99,13 @@ module GovukPublishingComponents
|
|
94
99
|
all_matches
|
95
100
|
end
|
96
101
|
|
102
|
+
def find_gem_references(file, src)
|
103
|
+
find_gem_classes = /gem-c-[-_a-zA-Z]+/
|
104
|
+
clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
|
105
|
+
|
106
|
+
return file[clean_file_path] if find_gem_classes.match?(src)
|
107
|
+
end
|
108
|
+
|
97
109
|
def clean_file_name(name)
|
98
110
|
name.tr("_-", " ").strip
|
99
111
|
end
|
@@ -36,6 +36,7 @@ module GovukPublishingComponents
|
|
36
36
|
warnings = []
|
37
37
|
warnings << warn_about_missing_components(result[:components_found])
|
38
38
|
warnings << warn_about_missing_assets(result[:components_found])
|
39
|
+
warnings << warn_about_style_overrides(result[:gem_style_references])
|
39
40
|
warnings = warnings.flatten
|
40
41
|
|
41
42
|
data << {
|
@@ -65,6 +66,7 @@ module GovukPublishingComponents
|
|
65
66
|
],
|
66
67
|
warnings: warnings,
|
67
68
|
warning_count: warnings.length,
|
69
|
+
gem_style_references: result[:gem_style_references],
|
68
70
|
}
|
69
71
|
else
|
70
72
|
data << {
|
@@ -150,6 +152,17 @@ module GovukPublishingComponents
|
|
150
152
|
!@gem_data[:component_code].include?(component) unless component == "all"
|
151
153
|
end
|
152
154
|
|
155
|
+
def warn_about_style_overrides(results)
|
156
|
+
warnings = []
|
157
|
+
|
158
|
+
results.each do |result|
|
159
|
+
warnings << create_warning("Possible component style override", result) if result.include? ".scss"
|
160
|
+
warnings << create_warning("Possible hard coded component markup", result) if [".html", ".rb"].any? { |needle| result.include? needle }
|
161
|
+
end
|
162
|
+
|
163
|
+
warnings
|
164
|
+
end
|
165
|
+
|
153
166
|
def find_missing(needle, haystack)
|
154
167
|
(haystack - needle).flatten.sort
|
155
168
|
end
|
@@ -20,7 +20,11 @@
|
|
20
20
|
</li>
|
21
21
|
</ul>
|
22
22
|
<div class="govuk-tabs__panel" id="applications">
|
23
|
-
|
23
|
+
<%= render "govuk_publishing_components/components/heading", {
|
24
|
+
text: "Applications",
|
25
|
+
font_size: "l",
|
26
|
+
margin_bottom: 6
|
27
|
+
} %>
|
24
28
|
|
25
29
|
<% if @applications.any? %>
|
26
30
|
<details class="govuk-details" data-module="govuk-details">
|
@@ -66,7 +70,12 @@
|
|
66
70
|
</p>
|
67
71
|
<% end %>
|
68
72
|
|
69
|
-
|
73
|
+
<%= render "govuk_publishing_components/components/heading", {
|
74
|
+
text: "Components used",
|
75
|
+
font_size: "m",
|
76
|
+
margin_bottom: 4,
|
77
|
+
heading_level: 3,
|
78
|
+
} %>
|
70
79
|
|
71
80
|
<dl class="govuk-summary-list">
|
72
81
|
<% application[:summary].each do |item| %>
|
@@ -84,6 +93,22 @@
|
|
84
93
|
</div>
|
85
94
|
<% end %>
|
86
95
|
</dl>
|
96
|
+
|
97
|
+
<% if application[:gem_style_references].any? %>
|
98
|
+
<%= render "govuk_publishing_components/components/heading", {
|
99
|
+
text: "Component references",
|
100
|
+
font_size: "m",
|
101
|
+
margin_bottom: 4,
|
102
|
+
heading_level: 3,
|
103
|
+
} %>
|
104
|
+
|
105
|
+
<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>
|
106
|
+
<ul class="govuk-list govuk-list--bullet">
|
107
|
+
<% application[:gem_style_references].each do |ref| %>
|
108
|
+
<li><%= ref %></li>
|
109
|
+
<% end %>
|
110
|
+
</ul>
|
111
|
+
<% end %>
|
87
112
|
<% else %>
|
88
113
|
<p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
|
89
114
|
<% end %>
|
@@ -97,7 +122,11 @@
|
|
97
122
|
</div>
|
98
123
|
|
99
124
|
<div class="govuk-tabs__panel govuk-tabs__panel--hidden" id="components-gem">
|
100
|
-
|
125
|
+
<%= render "govuk_publishing_components/components/heading", {
|
126
|
+
text: "Components",
|
127
|
+
font_size: "l",
|
128
|
+
margin_bottom: 6,
|
129
|
+
} %>
|
101
130
|
|
102
131
|
<% if @components.any? %>
|
103
132
|
<div class="govuk-accordion" data-module="govuk-accordion" id="accordion-default">
|