govuk_publishing_components 29.9.0 → 29.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +4 -4
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +20 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +3 -8
  5. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +7 -1
  6. data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -2
  7. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +0 -9
  8. data/app/models/govuk_publishing_components/audit_comparer.rb +92 -34
  9. data/app/views/govuk_publishing_components/audit/_applications.html.erb +20 -9
  10. data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -19
  11. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +20 -2
  12. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +18 -19
  13. data/config/locales/ar.yml +1 -2
  14. data/config/locales/az.yml +1 -2
  15. data/config/locales/be.yml +1 -2
  16. data/config/locales/bg.yml +1 -2
  17. data/config/locales/bn.yml +1 -2
  18. data/config/locales/cs.yml +1 -2
  19. data/config/locales/cy.yml +1 -2
  20. data/config/locales/da.yml +1 -2
  21. data/config/locales/de.yml +1 -2
  22. data/config/locales/dr.yml +1 -2
  23. data/config/locales/el.yml +1 -2
  24. data/config/locales/en.yml +9 -2
  25. data/config/locales/es-419.yml +1 -2
  26. data/config/locales/es.yml +1 -2
  27. data/config/locales/et.yml +1 -2
  28. data/config/locales/fa.yml +1 -2
  29. data/config/locales/fi.yml +1 -2
  30. data/config/locales/fr.yml +1 -2
  31. data/config/locales/gd.yml +1 -2
  32. data/config/locales/gu.yml +1 -2
  33. data/config/locales/he.yml +1 -2
  34. data/config/locales/hi.yml +1 -2
  35. data/config/locales/hr.yml +1 -2
  36. data/config/locales/hu.yml +1 -2
  37. data/config/locales/hy.yml +1 -2
  38. data/config/locales/id.yml +1 -2
  39. data/config/locales/is.yml +1 -2
  40. data/config/locales/it.yml +1 -2
  41. data/config/locales/ja.yml +1 -2
  42. data/config/locales/ka.yml +1 -2
  43. data/config/locales/kk.yml +1 -2
  44. data/config/locales/ko.yml +1 -2
  45. data/config/locales/lt.yml +1 -2
  46. data/config/locales/lv.yml +1 -2
  47. data/config/locales/ms.yml +1 -2
  48. data/config/locales/mt.yml +1 -2
  49. data/config/locales/nl.yml +1 -2
  50. data/config/locales/no.yml +1 -2
  51. data/config/locales/pa-pk.yml +1 -2
  52. data/config/locales/pa.yml +1 -2
  53. data/config/locales/pl.yml +1 -2
  54. data/config/locales/ps.yml +1 -2
  55. data/config/locales/pt.yml +1 -2
  56. data/config/locales/ro.yml +1 -2
  57. data/config/locales/ru.yml +1 -2
  58. data/config/locales/si.yml +1 -2
  59. data/config/locales/sk.yml +1 -2
  60. data/config/locales/sl.yml +1 -2
  61. data/config/locales/so.yml +1 -2
  62. data/config/locales/sq.yml +1 -2
  63. data/config/locales/sr.yml +1 -2
  64. data/config/locales/sv.yml +1 -2
  65. data/config/locales/sw.yml +1 -2
  66. data/config/locales/ta.yml +1 -2
  67. data/config/locales/th.yml +1 -2
  68. data/config/locales/tk.yml +1 -2
  69. data/config/locales/tr.yml +1 -2
  70. data/config/locales/uk.yml +1 -2
  71. data/config/locales/ur.yml +1 -2
  72. data/config/locales/uz.yml +1 -2
  73. data/config/locales/vi.yml +1 -2
  74. data/config/locales/zh-hk.yml +1 -2
  75. data/config/locales/zh-tw.yml +1 -2
  76. data/config/locales/zh.yml +1 -2
  77. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +1 -2
  78. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +35 -16
  79. data/lib/govuk_publishing_components/version.rb +1 -1
  80. data/node_modules/govuk-frontend/govuk/all.js +120 -49
  81. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +2 -2
  82. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +0 -2
  83. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +2 -2
  84. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +6 -16
  85. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +2 -2
  86. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +120 -49
  87. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +33 -17
  88. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +2 -2
  89. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -4
  90. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +3 -2
  91. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +22 -10
  92. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
  93. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +23 -23
  94. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  95. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +4 -4
  96. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +2 -2
  97. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +3 -3
  98. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +2 -2
  99. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +12 -22
  100. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +13 -3
  101. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
  102. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +2 -2
  103. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -13
  104. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +5 -5
  105. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +2 -2
  106. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +2 -2
  107. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +1 -1
  108. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +4 -4
  109. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +2 -2
  110. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -4
  111. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +17 -12
  112. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +2 -2
  113. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -3
  114. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +2 -2
  115. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +5 -5
  116. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +4 -4
  117. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +2 -2
  118. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +2 -2
  119. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +2 -2
  120. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +3 -3
  121. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +7 -5
  122. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -2
  123. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  124. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -3
  125. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +2 -2
  126. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +10 -26
  127. data/node_modules/govuk-frontend/govuk/objects/_template.scss +1 -1
  128. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +0 -4
  129. data/node_modules/govuk-frontend/govuk/tools/_exports.scss +1 -1
  130. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
  131. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
  132. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +2 -2
  133. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  134. data/node_modules/govuk-frontend/govuk-esm/all.mjs +88 -0
  135. data/node_modules/govuk-frontend/govuk-esm/common.mjs +28 -0
  136. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +374 -0
  137. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +64 -0
  138. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +251 -0
  139. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +164 -0
  140. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +147 -0
  141. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +168 -0
  142. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +52 -0
  143. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +55 -0
  144. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +122 -0
  145. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +94 -0
  146. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +282 -0
  147. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.js +264 -0
  148. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.js +26 -0
  149. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.js +93 -0
  150. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.js +24 -0
  151. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.js +23 -0
  152. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.js +22 -0
  153. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.js +22 -0
  154. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.js +114 -0
  155. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.js +252 -0
  156. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.js +159 -0
  157. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.js +86 -0
  158. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.js +20 -0
  159. data/node_modules/govuk-frontend/package.json +8 -1
  160. metadata +27 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0d30bd1a2b86ab711560f26438e2ba7907402831cc617b752d3e1fb05c2e6cc
4
- data.tar.gz: e13d38616b71e39a1e3e23df2999eb88f9824a668dc8347a4b914a58e86bf2bb
3
+ metadata.gz: c90f6280f1c3ce88606be0f030883575971e8fd8447cac1b353b2e1163221b63
4
+ data.tar.gz: 79e9a7c4d8f262fd3dd65d504aabcbff63cf7228479a540f7fb187cf4383e8fa
5
5
  SHA512:
6
- metadata.gz: d91d69b91a14c9f6acaf230a32c9c75385f54cd7c2ff924860f87e3578ea32f58726d16e0de1d5ccbfbeb808da0ceba804adc9827cd5ae2370dae3b6b478090b
7
- data.tar.gz: 036b79310b2cef0189a2536eab0d70bdf0d293cd079533da198f666c00ee04ddc7f34a22468ad4b853d2875fe1d44ec8ec305157c115ea19e0b2760e21ccd401
6
+ metadata.gz: 036a6a9d2e713632f5f8ca68b997017cf728dbf7f0dfa46709762b185ee32d576526bcad7ebbb453a0a8feb9e809c95dd5e86bf20d91d35293b2009fd972f0b3
7
+ data.tar.gz: 876823d94cae4f3fbbcc4a8e5c178a35e0d9c90b8ea5f0d29b8e9ec737097d9764608f3dbfea13f7d8ae8aa252c07f33fba46e53638cc249b1f20c86e0c99cc6
@@ -15,8 +15,8 @@
15
15
  return document.querySelectorAll('.document-collection .group-title').length
16
16
  case isNewBrowsePageLevelTwo():
17
17
  // if there are no accordion sections on the browse level 2 page
18
- // then it is a default page with only one section
19
- return document.querySelectorAll('[data-track-count="accordionSection"]').length || 1
18
+ // then it is a default page with one or two lists
19
+ return document.querySelectorAll('[data-track-count="accordionSection"]').length || document.querySelectorAll('main .govuk-list').length
20
20
  case isNewBrowsePage():
21
21
  return document.querySelectorAll('[data-track-count="cardList"]').length
22
22
  case isMainstreamBrowsePage():
@@ -77,7 +77,6 @@
77
77
  var metaApplicationSelector = 'meta[name="govuk:rendering-application"]'
78
78
  var metaFormatSelector = 'meta[name="govuk:format"]'
79
79
  var metaNavigationTypeSelector = 'meta[name="govuk:navigation-page-type"]'
80
- var metaSectionSelector = 'meta[name="govuk:section"]'
81
80
 
82
81
  function getMetaAttribute (selector) {
83
82
  var element = document.querySelector(selector)
@@ -111,7 +110,8 @@
111
110
 
112
111
  function isNewBrowsePage () {
113
112
  return getMetaAttribute(metaApplicationSelector) === 'collections' &&
114
- getMetaAttribute(metaSectionSelector) === 'new_browse_page' &&
113
+ (getMetaAttribute(metaNavigationTypeSelector) === 'browse level 0' ||
114
+ getMetaAttribute(metaNavigationTypeSelector) === 'browse level 1') &&
115
115
  getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
116
116
  }
117
117
 
@@ -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($button-pipe-colour, true);
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(2) govuk-spacing(6) govuk-spacing(2) govuk-spacing(5);
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;
@@ -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
- ].sort
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, false)
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, simple)
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, simple)
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, simple)
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
- unless @simple
46
- summary = [
47
- {
48
- name: "Components in templates",
49
- value: templates[:components].flatten.uniq.sort.join(", "),
50
- },
51
- {
52
- name: "Components in stylesheets",
53
- value: stylesheets[:components].join(", "),
54
- },
55
- {
56
- name: "Components in print stylesheets",
57
- value: print_stylesheets[:components].join(", "),
58
- },
59
- {
60
- name: "Components in javascripts",
61
- value: javascripts[:components].join(", "),
62
- },
63
- {
64
- name: "Components in ruby",
65
- value: ruby[:components].join(", "),
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
- if @gem_data.include?("component_#{second_location}".to_sym) && @gem_data["component_#{second_location}".to_sym].include?(component)
120
- warnings << create_warning(component, "Included in #{first_location} but not #{second_location}")
121
- end
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
- summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
25
+ if @other_applications
26
+ summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
26
27
 
27
- if application[:application_found]
28
- summary = "Warnings: 0"
29
- summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>" if application[:warning_count] > 0
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
- <% application[:warnings].each do |warning| %>
37
- <p class="govuk-body">
38
- <strong class="govuk-tag">Warn</strong>
39
- <strong><%= warning[:component] %></strong> - <%= warning[:message] %>
40
- </p>
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
- <% if ENV["MAIN_COMPONENT_GUIDE"] %>
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
 
@@ -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
- <span class="govuk-footer__licence-description">
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
- <div class="govuk-footer__meta-item">
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>
@@ -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
- <% data_attributes = {
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.p class: "gem-c-contextual-sidebar__text govuk-body" do %>
21
- <%= link_to link_text,
22
- link_path,
23
- class: "govuk-link",
24
- data: data_attributes,
25
- lang: lang %>
26
- <% end %>
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 %>
@@ -165,9 +165,8 @@ ar:
165
165
  link_text: تحقق مما تحتاج إلى القيام به
166
166
  title: برِيكْسِت
167
167
  ukraine:
168
- link_path:
169
- link_text:
170
168
  title:
169
+ links:
171
170
  world_locations: المواقع العالمية
172
171
  search_box:
173
172
  input_title: بحث
@@ -161,9 +161,8 @@ az:
161
161
  link_text: Nələri etməli olduğunuzu yoxlayın
162
162
  title: Brexit
163
163
  ukraine:
164
- link_path:
165
- link_text:
166
164
  title:
165
+ links:
167
166
  world_locations: Dünya üzrə yerləri
168
167
  search_box:
169
168
  input_title: Axtar
@@ -168,9 +168,8 @@ be:
168
168
  link_text: Праверце, што вам трэба зрабіць
169
169
  title: Брэкзiт
170
170
  ukraine:
171
- link_path:
172
- link_text:
173
171
  title:
172
+ links:
174
173
  world_locations: Мы ў свеце
175
174
  search_box:
176
175
  input_title: Пошук
@@ -166,9 +166,8 @@ bg:
166
166
  link_text: Проверете какво трябва да направите
167
167
  title: Брекзит
168
168
  ukraine:
169
- link_path:
170
- link_text:
171
169
  title:
170
+ links:
172
171
  world_locations: Местоположения по света
173
172
  search_box:
174
173
  input_title: Търсене
@@ -163,9 +163,8 @@ bn:
163
163
  link_text: আপনার যা করা প্রয়োজন তা দেখুন
164
164
  title: ব্রেক্সিট
165
165
  ukraine:
166
- link_path:
167
- link_text:
168
166
  title:
167
+ links:
169
168
  world_locations: বিশ্বের অবস্থানসমূহ
170
169
  search_box:
171
170
  input_title: খুঁজুন
@@ -167,9 +167,8 @@ cs:
167
167
  link_text: Zkontrolujte, co je třeba udělat
168
168
  title: Brexit
169
169
  ukraine:
170
- link_path:
171
- link_text:
172
170
  title:
171
+ links:
173
172
  world_locations: Místa ve světě
174
173
  search_box:
175
174
  input_title: Vyhledávání
@@ -166,9 +166,8 @@ cy:
166
166
  link_text: Gwiriwch beth mae angen i chi wneud
167
167
  title: Brexit
168
168
  ukraine:
169
- link_path:
170
- link_text:
171
169
  title:
170
+ links:
172
171
  world_locations: Lleoliadau byd-eang
173
172
  search_box:
174
173
  input_title: Chwilio
@@ -163,9 +163,8 @@ da:
163
163
  link_text: Tjek hvad du skal gøre
164
164
  title: Brexit
165
165
  ukraine:
166
- link_path:
167
- link_text:
168
166
  title:
167
+ links:
169
168
  world_locations: Verden Placeringer
170
169
  search_box:
171
170
  input_title: Søge
@@ -166,9 +166,8 @@ de:
166
166
  link_text: Prüfen Sie, was Sie machen müssen
167
167
  title: Brexit
168
168
  ukraine:
169
- link_path:
170
- link_text:
171
169
  title:
170
+ links:
172
171
  world_locations: Weltweite Standorte
173
172
  search_box:
174
173
  input_title: Suche
@@ -164,9 +164,8 @@ dr:
164
164
  link_text: بیبینید که چه کاری باید انجام دهید
165
165
  title: برکست
166
166
  ukraine:
167
- link_path:
168
- link_text:
169
167
  title:
168
+ links:
170
169
  world_locations: موقعیت هایی جهان
171
170
  search_box:
172
171
  input_title: جستجو نمایید
@@ -162,9 +162,8 @@ el:
162
162
  link_text: Ελέγξτε τι πρέπει να κάνετε
163
163
  title: Brexit
164
164
  ukraine:
165
- link_path:
166
- link_text:
167
165
  title:
166
+ links:
168
167
  world_locations: Παγκόσμιες τοποθεσίες
169
168
  search_box:
170
169
  input_title: Αναζήτηση