govuk_publishing_components 29.8.0 → 29.11.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/analytics/page-content.js +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js +33 -23
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +15 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js +18 -9
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +166 -142
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +20 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +3 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +7 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_organisation-logo.scss +4 -0
- data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -2
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +0 -9
- data/app/models/govuk_publishing_components/audit_comparer.rb +92 -34
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +20 -9
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -19
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +7 -5
- data/app/views/govuk_publishing_components/components/_character_count.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_date_input.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_input.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +20 -2
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +4 -5
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +18 -19
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +20 -13
- data/config/locales/ar.yml +1 -2
- data/config/locales/az.yml +1 -2
- data/config/locales/be.yml +1 -2
- data/config/locales/bg.yml +1 -2
- data/config/locales/bn.yml +1 -2
- data/config/locales/cs.yml +1 -2
- data/config/locales/cy.yml +1 -2
- data/config/locales/da.yml +1 -2
- data/config/locales/de.yml +1 -2
- data/config/locales/dr.yml +1 -2
- data/config/locales/el.yml +1 -2
- data/config/locales/en.yml +9 -2
- data/config/locales/es-419.yml +1 -2
- data/config/locales/es.yml +1 -2
- data/config/locales/et.yml +1 -2
- data/config/locales/fa.yml +1 -2
- data/config/locales/fi.yml +1 -2
- data/config/locales/fr.yml +1 -2
- data/config/locales/gd.yml +1 -2
- data/config/locales/gu.yml +1 -2
- data/config/locales/he.yml +1 -2
- data/config/locales/hi.yml +1 -2
- data/config/locales/hr.yml +1 -2
- data/config/locales/hu.yml +1 -2
- data/config/locales/hy.yml +1 -2
- data/config/locales/id.yml +1 -2
- data/config/locales/is.yml +1 -2
- data/config/locales/it.yml +1 -2
- data/config/locales/ja.yml +1 -2
- data/config/locales/ka.yml +1 -2
- data/config/locales/kk.yml +1 -2
- data/config/locales/ko.yml +1 -2
- data/config/locales/lt.yml +1 -2
- data/config/locales/lv.yml +1 -2
- data/config/locales/ms.yml +1 -2
- data/config/locales/mt.yml +1 -2
- data/config/locales/nl.yml +1 -2
- data/config/locales/no.yml +1 -2
- data/config/locales/pa-pk.yml +1 -2
- data/config/locales/pa.yml +1 -2
- data/config/locales/pl.yml +1 -2
- data/config/locales/ps.yml +1 -2
- data/config/locales/pt.yml +1 -2
- data/config/locales/ro.yml +1 -2
- data/config/locales/ru.yml +1 -2
- data/config/locales/si.yml +1 -2
- data/config/locales/sk.yml +1 -2
- data/config/locales/sl.yml +1 -2
- data/config/locales/so.yml +1 -2
- data/config/locales/sq.yml +1 -2
- data/config/locales/sr.yml +1 -2
- data/config/locales/sv.yml +1 -2
- data/config/locales/sw.yml +1 -2
- data/config/locales/ta.yml +1 -2
- data/config/locales/th.yml +1 -2
- data/config/locales/tk.yml +1 -2
- data/config/locales/tr.yml +1 -2
- data/config/locales/uk.yml +1 -2
- data/config/locales/ur.yml +1 -2
- data/config/locales/uz.yml +1 -2
- data/config/locales/vi.yml +1 -2
- data/config/locales/zh-hk.yml +1 -2
- data/config/locales/zh-tw.yml +1 -2
- data/config/locales/zh.yml +1 -2
- data/lib/govuk_publishing_components/presenters/attachment_helper.rb +1 -2
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +35 -16
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/govuk/all.js +120 -49
- data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +0 -2
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +6 -16
- data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +120 -49
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +33 -17
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -4
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +3 -2
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +22 -10
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +23 -23
- data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +4 -4
- data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +12 -22
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +13 -3
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -13
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +5 -5
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +4 -4
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -4
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +17 -12
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -3
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +5 -5
- data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +4 -4
- data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +3 -3
- data/node_modules/govuk-frontend/govuk/helpers/_links.scss +7 -5
- data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -2
- data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -3
- data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +2 -2
- data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +10 -26
- data/node_modules/govuk-frontend/govuk/objects/_template.scss +1 -1
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +0 -4
- data/node_modules/govuk-frontend/govuk/tools/_exports.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +2 -2
- data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +88 -0
- data/node_modules/govuk-frontend/govuk-esm/common.mjs +28 -0
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +374 -0
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +64 -0
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +251 -0
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +164 -0
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +147 -0
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +168 -0
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +52 -0
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +55 -0
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +122 -0
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +94 -0
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +282 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.js +264 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.js +26 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.js +93 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.js +24 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.js +23 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.js +22 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.js +22 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.js +114 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.js +252 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.js +159 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.js +86 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.js +20 -0
- data/node_modules/govuk-frontend/package.json +8 -1
- metadata +28 -3
@@ -10,6 +10,7 @@
|
|
10
10
|
@import "components/print/govspeak-html-publication";
|
11
11
|
@import "components/print/govspeak";
|
12
12
|
@import "components/print/layout-super-navigation-header";
|
13
|
+
@import "components/print/organisation-logo";
|
13
14
|
@import "components/print/step-by-step-nav-header";
|
14
15
|
@import "components/print/step-by-step-nav";
|
15
16
|
@import "components/print/textarea";
|
@@ -8,6 +8,12 @@
|
|
8
8
|
color: $govuk-text-colour;
|
9
9
|
}
|
10
10
|
|
11
|
+
.gem-c-contextual-sidebar__list {
|
12
|
+
margin: 0;
|
13
|
+
padding: 0;
|
14
|
+
list-style: none;
|
15
|
+
}
|
16
|
+
|
11
17
|
.gem-c-contextual-sidebar__text {
|
12
18
|
@include govuk-font(16);
|
13
19
|
margin-bottom: govuk-spacing(1);
|
@@ -24,3 +30,17 @@
|
|
24
30
|
padding: 0 govuk-spacing(3) govuk-spacing(3);
|
25
31
|
text-decoration: none;
|
26
32
|
}
|
33
|
+
|
34
|
+
.gem-c-contextual-sidebar__cta--ukraine {
|
35
|
+
border-top: 7px solid #fed700;
|
36
|
+
position: relative;
|
37
|
+
|
38
|
+
&:before {
|
39
|
+
content: "";
|
40
|
+
position: absolute;
|
41
|
+
left: 0;
|
42
|
+
right: 0;
|
43
|
+
top: -14px;
|
44
|
+
border-top: 7px solid #4b7ec1;
|
45
|
+
}
|
46
|
+
}
|
@@ -382,10 +382,8 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
382
382
|
}
|
383
383
|
|
384
384
|
.gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner {
|
385
|
-
border-color: $button-pipe-colour;
|
386
|
-
|
387
385
|
&:before {
|
388
|
-
@include chevron(
|
386
|
+
@include chevron(govuk-colour("mid-grey"), true);
|
389
387
|
}
|
390
388
|
}
|
391
389
|
}
|
@@ -464,7 +462,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
464
462
|
.gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner {
|
465
463
|
@include govuk-media-query($from: "desktop") {
|
466
464
|
display: inline-block;
|
467
|
-
padding: govuk-spacing(
|
465
|
+
padding: govuk-spacing(1) govuk-spacing(6) govuk-spacing(1) govuk-spacing(5);
|
468
466
|
}
|
469
467
|
}
|
470
468
|
|
@@ -608,10 +606,6 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
608
606
|
}
|
609
607
|
}
|
610
608
|
|
611
|
-
&:after {
|
612
|
-
@include pseudo-underline;
|
613
|
-
}
|
614
|
-
|
615
609
|
// Open button modifier
|
616
610
|
&.gem-c-layout-super-navigation-header__open-button {
|
617
611
|
// stylelint-disable max-nesting-depth
|
@@ -771,6 +765,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
771
765
|
background: govuk-colour("light-grey");
|
772
766
|
|
773
767
|
@include govuk-media-query($from: "desktop") {
|
768
|
+
border-bottom: 1px govuk-colour("mid-grey") solid;
|
774
769
|
left: 0;
|
775
770
|
position: absolute;
|
776
771
|
right: 0;
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss
CHANGED
@@ -37,7 +37,8 @@
|
|
37
37
|
margin-left: -($thumbnail-width + govuk-spacing(6) - $govuk-border-width);
|
38
38
|
padding-bottom: govuk-spacing(3);
|
39
39
|
|
40
|
-
img
|
40
|
+
img,
|
41
|
+
svg {
|
41
42
|
display: block;
|
42
43
|
width: $thumbnail-width;
|
43
44
|
height: 140px;
|
@@ -56,6 +57,11 @@
|
|
56
57
|
|
57
58
|
box-shadow: 0 2px 2px rgba(govuk-colour("black"), .4);
|
58
59
|
}
|
60
|
+
|
61
|
+
svg {
|
62
|
+
fill: govuk-colour("mid-grey", $legacy: "grey-3");
|
63
|
+
stroke: govuk-colour("mid-grey", $legacy: "grey-3");
|
64
|
+
}
|
59
65
|
}
|
60
66
|
|
61
67
|
.attachment-details {
|
@@ -24,7 +24,8 @@ module GovukPublishingComponents
|
|
24
24
|
static
|
25
25
|
travel-advice-publisher
|
26
26
|
whitehall
|
27
|
-
]
|
27
|
+
]
|
28
|
+
|
28
29
|
application_dirs = [GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(Rails.root)] unless ENV["MAIN_COMPONENT_GUIDE"]
|
29
30
|
|
30
31
|
gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
|
@@ -36,7 +37,7 @@ module GovukPublishingComponents
|
|
36
37
|
|
37
38
|
components = AuditComponents.new(gem_path, false)
|
38
39
|
applications = analyse_applications(host_dir, application_dirs)
|
39
|
-
compared_data = AuditComparer.new(components.data, applications
|
40
|
+
compared_data = AuditComparer.new(components.data, applications)
|
40
41
|
|
41
42
|
@applications = compared_data.applications_data || []
|
42
43
|
@components = compared_data.gem_data || []
|
@@ -13,7 +13,6 @@ module GovukPublishingComponents
|
|
13
13
|
@components_in_use_sass = components_in_use_sass(false)
|
14
14
|
@components_in_use_print_sass = components_in_use_sass(true)
|
15
15
|
@components_in_use_js = components_in_use_js
|
16
|
-
@index_audit_summary = index_audit_summary
|
17
16
|
end
|
18
17
|
|
19
18
|
def show
|
@@ -162,13 +161,5 @@ module GovukPublishingComponents
|
|
162
161
|
h[:url] = component_doc_path(component_doc.id) if component_example
|
163
162
|
end
|
164
163
|
end
|
165
|
-
|
166
|
-
def index_audit_summary
|
167
|
-
components_gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
|
168
|
-
components = AuditComponents.new(components_gem_path, true)
|
169
|
-
application = AuditApplications.new(@application_path, GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(@application_path))
|
170
|
-
compared_data = AuditComparer.new(components.data, [application.data], true)
|
171
|
-
compared_data.applications_data[0]
|
172
|
-
end
|
173
164
|
end
|
174
165
|
end
|
@@ -2,26 +2,59 @@ module GovukPublishingComponents
|
|
2
2
|
class AuditComparer
|
3
3
|
attr_reader :applications_data, :gem_data
|
4
4
|
|
5
|
-
def initialize(gem_data, results
|
5
|
+
def initialize(gem_data, results)
|
6
6
|
if gem_data[:gem_found]
|
7
|
+
@applications_using_static = %w[
|
8
|
+
collections
|
9
|
+
email-alert-frontend
|
10
|
+
feedback
|
11
|
+
finder-frontend
|
12
|
+
frontend
|
13
|
+
government-frontend
|
14
|
+
info-frontend
|
15
|
+
licence-finder
|
16
|
+
manuals-frontend
|
17
|
+
service-manual-frontend
|
18
|
+
smart-answers
|
19
|
+
whitehall
|
20
|
+
]
|
21
|
+
|
22
|
+
@static_data = find_static(results)
|
7
23
|
@gem_data = gem_data
|
8
|
-
@applications_data = sort_results(results
|
24
|
+
@applications_data = sort_results(results)
|
9
25
|
@gem_data[:components_by_application] = get_components_by_application || []
|
10
26
|
end
|
11
27
|
end
|
12
28
|
|
13
29
|
private
|
14
30
|
|
31
|
+
# find static to check for global includes, reduce false warnings
|
32
|
+
def find_static(results)
|
33
|
+
results.each do |result|
|
34
|
+
if result[:name] == "static" && result[:application_found] == true
|
35
|
+
return clean_static(result)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
false
|
40
|
+
end
|
41
|
+
|
42
|
+
# turn static data into an object so locations can be easily referenced
|
43
|
+
# should give object of form { "templates" => [], "stylesheets" => [] }
|
44
|
+
def clean_static(data)
|
45
|
+
Hash[data[:components_found].map { |d| [d[:location], d[:components]] }]
|
46
|
+
end
|
47
|
+
|
15
48
|
def prettify_key(key)
|
16
49
|
key.to_s.gsub("_", " ").capitalize
|
17
50
|
end
|
18
51
|
|
19
|
-
def sort_results(results
|
20
|
-
@simple = simple
|
52
|
+
def sort_results(results)
|
21
53
|
data = []
|
22
54
|
|
23
55
|
results.each do |result|
|
24
56
|
if result[:application_found]
|
57
|
+
application_uses_static = @applications_using_static.include?(result[:name])
|
25
58
|
templates = result[:components_found].find { |c| c[:location] == "templates" }
|
26
59
|
stylesheets = result[:components_found].find { |c| c[:location] == "stylesheets" }
|
27
60
|
print_stylesheets = result[:components_found].find { |c| c[:location] == "print_stylesheets" }
|
@@ -39,37 +72,36 @@ module GovukPublishingComponents
|
|
39
72
|
warnings << warn_about_missing_assets(result[:components_found])
|
40
73
|
warnings << warn_about_style_overrides(result[:gem_style_references])
|
41
74
|
warnings << warn_about_jquery_references(result[:jquery_references])
|
75
|
+
warnings << check_for_assets_already_in_static(result[:components_found]) if @static_data && application_uses_static
|
42
76
|
warnings = warnings.flatten
|
43
77
|
|
44
|
-
summary = [
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
},
|
67
|
-
]
|
68
|
-
end
|
78
|
+
summary = [
|
79
|
+
{
|
80
|
+
name: "Components in templates",
|
81
|
+
value: templates[:components].flatten.uniq.sort.join(", "),
|
82
|
+
},
|
83
|
+
{
|
84
|
+
name: "Components in stylesheets",
|
85
|
+
value: stylesheets[:components].join(", "),
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: "Components in print stylesheets",
|
89
|
+
value: print_stylesheets[:components].join(", "),
|
90
|
+
},
|
91
|
+
{
|
92
|
+
name: "Components in javascripts",
|
93
|
+
value: javascripts[:components].join(", "),
|
94
|
+
},
|
95
|
+
{
|
96
|
+
name: "Components in ruby",
|
97
|
+
value: ruby[:components].join(", "),
|
98
|
+
},
|
99
|
+
]
|
69
100
|
|
70
101
|
data << {
|
71
102
|
name: result[:name],
|
72
103
|
application_found: result[:application_found],
|
104
|
+
uses_static: application_uses_static,
|
73
105
|
summary: summary,
|
74
106
|
warnings: warnings,
|
75
107
|
warning_count: warnings.length,
|
@@ -102,6 +134,7 @@ module GovukPublishingComponents
|
|
102
134
|
}
|
103
135
|
end
|
104
136
|
|
137
|
+
# given two groups of components, check the difference
|
105
138
|
def find_missing_items(first_group, second_group)
|
106
139
|
warnings = []
|
107
140
|
|
@@ -111,14 +144,20 @@ module GovukPublishingComponents
|
|
111
144
|
second_group.each do |second|
|
112
145
|
second_location = second[:location]
|
113
146
|
second_location = "code" if %w[templates ruby].include?(second_location)
|
147
|
+
# subtract one group from the other, leaving only those not in both
|
114
148
|
in_current = find_missing(second[:components].clone, first[:components].clone)
|
115
149
|
|
116
150
|
next if second[:components].include?("all")
|
117
151
|
|
152
|
+
# now we have a list of 'missing' component assets, check the gem to see if that asset exists
|
118
153
|
in_current.each do |component|
|
119
|
-
|
120
|
-
|
121
|
-
|
154
|
+
asset_in_gem = @gem_data.include?("component_#{second_location}".to_sym) && @gem_data["component_#{second_location}".to_sym].include?(component)
|
155
|
+
check_static = @static_data && second_location != "code"
|
156
|
+
asset_in_static = asset_already_in_static(second_location, component) if check_static
|
157
|
+
raise_warning = asset_in_gem && !asset_in_static
|
158
|
+
|
159
|
+
# this raises a warning if the asset exists and isn't included either in the application or static
|
160
|
+
warnings << create_warning(component, "Included in #{first_location} but not #{second_location}") if raise_warning
|
122
161
|
end
|
123
162
|
end
|
124
163
|
end
|
@@ -126,6 +165,27 @@ module GovukPublishingComponents
|
|
126
165
|
warnings
|
127
166
|
end
|
128
167
|
|
168
|
+
def asset_already_in_static(location, component)
|
169
|
+
return true if @static_data[location].include?(component)
|
170
|
+
|
171
|
+
false
|
172
|
+
end
|
173
|
+
|
174
|
+
def check_for_assets_already_in_static(locations)
|
175
|
+
warnings = []
|
176
|
+
|
177
|
+
locations.each do |location|
|
178
|
+
next if location[:location] == "templates" || location[:location] == "ruby"
|
179
|
+
|
180
|
+
location[:components].each do |component|
|
181
|
+
raise_warning = asset_already_in_static(location[:location], component)
|
182
|
+
warnings << create_warning(component, "Included in #{location[:location]} but already included in static") if raise_warning
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
warnings
|
187
|
+
end
|
188
|
+
|
129
189
|
def warn_about_missing_assets(components)
|
130
190
|
warnings = []
|
131
191
|
|
@@ -186,8 +246,6 @@ module GovukPublishingComponents
|
|
186
246
|
end
|
187
247
|
|
188
248
|
def get_components_by_application
|
189
|
-
return [] if @simple
|
190
|
-
|
191
249
|
results = []
|
192
250
|
found_something = false
|
193
251
|
|
@@ -22,22 +22,33 @@
|
|
22
22
|
%>
|
23
23
|
<% application_items = @applications.map do |application| %>
|
24
24
|
<%
|
25
|
-
|
25
|
+
if @other_applications
|
26
|
+
summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
if application[:application_found]
|
29
|
+
summary = "Warnings: 0"
|
30
|
+
summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>" if application[:warning_count] > 0
|
31
|
+
end
|
30
32
|
end
|
31
33
|
%>
|
32
34
|
|
33
35
|
<% accordion_content = capture do %>
|
34
36
|
<% if application[:application_found] %>
|
35
37
|
<% github_link = 'https://github.com/alphagov/' + application[:name] + '/blob/main/' %>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
38
|
+
|
39
|
+
<% if @other_applications %>
|
40
|
+
<% if application[:uses_static] %>
|
41
|
+
<p class="govuk-body">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.</p>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
<% application[:warnings].each do |warning| %>
|
45
|
+
<p class="govuk-body">
|
46
|
+
<strong class="govuk-tag">Warn</strong>
|
47
|
+
<strong><%= warning[:component] %></strong> - <%= warning[:message] %>
|
48
|
+
</p>
|
49
|
+
<% end %>
|
50
|
+
<% else %>
|
51
|
+
<p class="govuk-body">More information about this application is available by viewing the component guide from a locally running instance of govuk_publishing_components.</p>
|
41
52
|
<% end %>
|
42
53
|
|
43
54
|
<%= render "govuk_publishing_components/components/heading", {
|
@@ -1,29 +1,11 @@
|
|
1
1
|
<%= render 'govuk_publishing_components/components/title', title: GovukPublishingComponents::Config.component_guide_title, margin_top: 0 %>
|
2
2
|
|
3
|
-
<% unless ENV["MAIN_COMPONENT_GUIDE"] %>
|
4
|
-
<p class="govuk-body">
|
5
|
-
<% if @index_audit_summary[:application_found] %>
|
6
|
-
Warnings:
|
7
|
-
<% if @index_audit_summary[:warning_count] > 0 %>
|
8
|
-
<strong class="govuk-tag govuk-tag--red"><%= @index_audit_summary[:warning_count] %></strong>
|
9
|
-
<% else %>
|
10
|
-
<%= @index_audit_summary[:warning_count] %>
|
11
|
-
<% end %>
|
12
|
-
<a href="/component-guide/audit" class="govuk-link">Warning details</a>
|
13
|
-
<% else %>
|
14
|
-
<strong class="govuk-tag govuk-tag--red">Application not found</strong>
|
15
|
-
<% end %>
|
16
|
-
</p>
|
17
|
-
<% end %>
|
18
|
-
|
19
3
|
<div class="component-markdown">
|
20
4
|
<p>Components are packages of template, style, behaviour and documentation that live in your application.</p>
|
21
5
|
<p>See the <a href="https://github.com/alphagov/govuk_publishing_components">govuk_publishing_components gem</a> for further details, or <a href="https://docs.publishing.service.gov.uk/manual/components.html#component-guides">a list of all component guides</a>.</p>
|
22
6
|
<ul>
|
23
7
|
<li>Read about how to <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/publishing-to-rubygems.md">release a new version of the gem</a></li>
|
24
|
-
|
25
|
-
<li><a href="/component-guide/audit">View component audits</a></li>
|
26
|
-
<% end %>
|
8
|
+
<li><a href="/component-guide/audit">View component audits</a></li>
|
27
9
|
</ul>
|
28
10
|
</div>
|
29
11
|
|
@@ -27,6 +27,9 @@
|
|
27
27
|
data_attributes[:track_show_all_clicks] = track_show_all_clicks
|
28
28
|
data_attributes[:track_sections] = track_sections
|
29
29
|
|
30
|
+
data_attributes_show_all ||= nil
|
31
|
+
data_attributes[:show_all_attributes] = data_attributes_show_all if data_attributes_show_all
|
32
|
+
|
30
33
|
translations.each do |key, translation|
|
31
34
|
locales[key] = shared_helper.t_locale(translation)
|
32
35
|
data_attributes[key] = t(translation)
|
@@ -47,8 +50,8 @@
|
|
47
50
|
<%= tag.div(class: accordion_classes, id: id, data: data_attributes) do %>
|
48
51
|
<% items.each_with_index do |item, i| %>
|
49
52
|
<%
|
50
|
-
# The GOVUK Frontend JavaScript for this component
|
51
|
-
# uses a loop starting at 1 for accessing heading ID values,
|
53
|
+
# The GOVUK Frontend JavaScript for this component
|
54
|
+
# uses a loop starting at 1 for accessing heading ID values,
|
52
55
|
# hence the increment below
|
53
56
|
index = i + 1
|
54
57
|
|
@@ -65,11 +68,10 @@
|
|
65
68
|
content_tag(
|
66
69
|
shared_helper.get_heading_level,
|
67
70
|
content_tag(
|
68
|
-
'span',
|
69
|
-
item[:heading][:text],
|
71
|
+
'span',
|
72
|
+
item[:heading][:text],
|
70
73
|
class: "govuk-accordion__section-button",
|
71
74
|
id: "#{id}-heading-#{index}"
|
72
|
-
|
73
75
|
),
|
74
76
|
class: "govuk-accordion__section-heading",
|
75
77
|
id: item[:heading][:id],
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
<%= render "govuk_publishing_components/components/textarea", { id: id, character_count: true }.merge(textarea.symbolize_keys) %>
|
19
19
|
|
20
|
-
<div id="<%= id %>-info" class="govuk-hint govuk-character-count__message"
|
20
|
+
<div id="<%= id %>-info" class="govuk-hint govuk-character-count__message">
|
21
21
|
<%= t("components.character_count.body", number: maxlength || maxwords, type: maxwords ? t("components.character_count.type.words") : t("components.character_count.type.characters")) %>
|
22
22
|
</div>
|
23
23
|
<% end %>
|
@@ -78,11 +78,29 @@
|
|
78
78
|
d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"
|
79
79
|
/>
|
80
80
|
</svg>
|
81
|
-
|
81
|
+
<% # this is to avoid having hardcoded data attributes in locale files %>
|
82
|
+
<span
|
83
|
+
class="govuk-footer__licence-description"
|
84
|
+
data-module="gem-track-click"
|
85
|
+
data-track-action="copyrightLink"
|
86
|
+
data-track-category="footerClicked"
|
87
|
+
data-track-label="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
|
88
|
+
data-track-options='{"dimension29": "Open Government Licence v3.0"}'
|
89
|
+
data-track-links-only
|
90
|
+
>
|
82
91
|
<%= t("components.layout_footer.licence_html") %>
|
83
92
|
</span>
|
84
93
|
</div>
|
85
|
-
|
94
|
+
<% # this is to avoid having hardcoded data attributes in locale files %>
|
95
|
+
<div
|
96
|
+
class="govuk-footer__meta-item"
|
97
|
+
data-module="gem-track-click"
|
98
|
+
data-track-action="copyrightLink"
|
99
|
+
data-track-category="footerClicked"
|
100
|
+
data-track-label="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
|
101
|
+
data-track-options='{"dimension29": "© Crown copyright"}'
|
102
|
+
data-track-links-only
|
103
|
+
>
|
86
104
|
<%= t("components.layout_footer.copyright_html") %>
|
87
105
|
</div>
|
88
106
|
</div>
|
@@ -107,20 +107,19 @@
|
|
107
107
|
<% if edit_link && delete_link %>
|
108
108
|
<%= tag.dd class: "govuk-summary-list__actions" do %>
|
109
109
|
<%= tag.ul class: "govuk-summary-list__actions-list" do %>
|
110
|
-
<% if
|
110
|
+
<% if edit_link %>
|
111
111
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do %>
|
112
112
|
<%= edit_link %>
|
113
113
|
<% end %>
|
114
114
|
<% end %>
|
115
|
-
<% if
|
115
|
+
<% if delete_link %>
|
116
116
|
<%= tag.li class: "govuk-summary-list__actions-list-item" do %>
|
117
117
|
<%= delete_link %>
|
118
118
|
<% end %>
|
119
119
|
<% end %>
|
120
120
|
<% end %>
|
121
121
|
<% end %>
|
122
|
-
<%
|
123
|
-
<% if edit_link || delete_link %>
|
122
|
+
<% elsif edit_link || delete_link %>
|
124
123
|
<%= tag.dd class: "govuk-summary-list__actions" do %>
|
125
124
|
<%= edit_link %>
|
126
125
|
<%= delete_link %>
|
@@ -130,7 +129,7 @@
|
|
130
129
|
<% end %>
|
131
130
|
<% end %>
|
132
131
|
<% end %>
|
133
|
-
|
132
|
+
|
134
133
|
<%= tag.div block, class: "gem-c-summary__block" if block %>
|
135
134
|
<% end %>
|
136
135
|
<% end %>
|
data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
<% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
|
2
2
|
<%
|
3
3
|
title = t("components.related_navigation.ukraine.title")
|
4
|
-
link_text = t("components.related_navigation.ukraine.link_text")
|
5
|
-
link_path = t("components.related_navigation.ukraine.link_path")
|
6
4
|
lang = shared_helper.t_locale("components.related_navigation.ukraine.title")
|
7
5
|
%>
|
8
6
|
|
9
|
-
|
10
|
-
"module": "gem-track-click",
|
11
|
-
"track-category": "relatedLinkClicked",
|
12
|
-
"track-action": "1.0 Invasion of Ukraine",
|
13
|
-
"track-label": link_path,
|
14
|
-
"track-dimension": link_text,
|
15
|
-
"track-dimension-index": "29",
|
16
|
-
} %>
|
17
|
-
|
18
|
-
<%= tag.div class: "gem-c-contextual-sidebar__cta" do %>
|
7
|
+
<%= tag.div class: "gem-c-contextual-sidebar__cta gem-c-contextual-sidebar__cta--ukraine", data: { module: "gem-track-click" } do %>
|
19
8
|
<%= tag.h2 title, class: "gem-c-contextual-sidebar__heading govuk-heading-s" %>
|
20
|
-
<%= tag.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
<%= tag.ul class: "gem-c-contextual-sidebar__list" do %>
|
10
|
+
<% t("components.related_navigation.ukraine.links").each do |link| %>
|
11
|
+
<%= tag.li class: "gem-c-contextual-sidebar__text govuk-body" do %>
|
12
|
+
<%= link_to link[:label],
|
13
|
+
link[:href],
|
14
|
+
class: "govuk-link",
|
15
|
+
data: {
|
16
|
+
"track-category": "relatedLinkClicked",
|
17
|
+
"track-action": "1.0 Invasion of Ukraine",
|
18
|
+
"track-label": link[:href],
|
19
|
+
"track-dimension": link[:label],
|
20
|
+
"track-dimension-index": "29",
|
21
|
+
},
|
22
|
+
lang: lang %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
27
26
|
<% end %>
|