govuk_publishing_components 29.7.0 → 29.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +72 -73
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +13 -2
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js +49 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
  6. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +0 -1
  7. data/app/assets/javascripts/govuk_publishing_components/modules.js +0 -1
  8. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js +37 -0
  9. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +166 -142
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +11 -4
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +20 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +3 -8
  13. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +8 -2
  14. data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -2
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +0 -9
  16. data/app/models/govuk_publishing_components/audit_comparer.rb +92 -34
  17. data/app/views/govuk_publishing_components/audit/_applications.html.erb +20 -9
  18. data/app/views/govuk_publishing_components/component_guide/index.html.erb +3 -21
  19. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  20. data/app/views/govuk_publishing_components/components/_cards.html.erb +13 -11
  21. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +20 -2
  22. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +4 -5
  23. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +18 -19
  24. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +1 -1
  25. data/app/views/govuk_publishing_components/components/docs/document_list.yml +4 -4
  26. data/app/views/govuk_publishing_components/components/docs/heading.yml +1 -1
  27. data/app/views/govuk_publishing_components/components/docs/image_card.yml +1 -1
  28. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +4 -4
  29. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -1
  30. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  31. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +1 -1
  32. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +1 -2
  33. data/config/locales/ar.yml +1 -2
  34. data/config/locales/az.yml +1 -2
  35. data/config/locales/be.yml +1 -2
  36. data/config/locales/bg.yml +1 -2
  37. data/config/locales/bn.yml +1 -2
  38. data/config/locales/cs.yml +1 -2
  39. data/config/locales/cy.yml +1 -2
  40. data/config/locales/da.yml +1 -2
  41. data/config/locales/de.yml +1 -2
  42. data/config/locales/dr.yml +1 -2
  43. data/config/locales/el.yml +1 -2
  44. data/config/locales/en.yml +9 -2
  45. data/config/locales/es-419.yml +1 -2
  46. data/config/locales/es.yml +1 -2
  47. data/config/locales/et.yml +1 -2
  48. data/config/locales/fa.yml +1 -2
  49. data/config/locales/fi.yml +1 -2
  50. data/config/locales/fr.yml +1 -2
  51. data/config/locales/gd.yml +1 -2
  52. data/config/locales/gu.yml +1 -2
  53. data/config/locales/he.yml +1 -2
  54. data/config/locales/hi.yml +1 -2
  55. data/config/locales/hr.yml +1 -2
  56. data/config/locales/hu.yml +1 -2
  57. data/config/locales/hy.yml +1 -2
  58. data/config/locales/id.yml +1 -2
  59. data/config/locales/is.yml +1 -2
  60. data/config/locales/it.yml +1 -2
  61. data/config/locales/ja.yml +1 -2
  62. data/config/locales/ka.yml +1 -2
  63. data/config/locales/kk.yml +1 -2
  64. data/config/locales/ko.yml +1 -2
  65. data/config/locales/lt.yml +1 -2
  66. data/config/locales/lv.yml +1 -2
  67. data/config/locales/ms.yml +1 -2
  68. data/config/locales/mt.yml +1 -2
  69. data/config/locales/nl.yml +1 -2
  70. data/config/locales/no.yml +1 -2
  71. data/config/locales/pa-pk.yml +1 -2
  72. data/config/locales/pa.yml +1 -2
  73. data/config/locales/pl.yml +1 -2
  74. data/config/locales/ps.yml +1 -2
  75. data/config/locales/pt.yml +1 -2
  76. data/config/locales/ro.yml +1 -2
  77. data/config/locales/ru.yml +1 -2
  78. data/config/locales/si.yml +1 -2
  79. data/config/locales/sk.yml +1 -2
  80. data/config/locales/sl.yml +1 -2
  81. data/config/locales/so.yml +1 -2
  82. data/config/locales/sq.yml +1 -2
  83. data/config/locales/sr.yml +1 -2
  84. data/config/locales/sv.yml +1 -2
  85. data/config/locales/sw.yml +1 -2
  86. data/config/locales/ta.yml +1 -2
  87. data/config/locales/th.yml +1 -2
  88. data/config/locales/tk.yml +1 -2
  89. data/config/locales/tr.yml +1 -2
  90. data/config/locales/uk.yml +1 -2
  91. data/config/locales/ur.yml +1 -2
  92. data/config/locales/uz.yml +1 -2
  93. data/config/locales/vi.yml +1 -2
  94. data/config/locales/zh-hk.yml +1 -2
  95. data/config/locales/zh-tw.yml +1 -2
  96. data/config/locales/zh.yml +1 -2
  97. data/lib/generators/govuk_publishing_components/templates/_component.html.erb +1 -1
  98. data/lib/govuk_publishing_components/app_helpers/brand_helper.rb +1 -1
  99. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +1 -3
  100. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +35 -16
  101. data/lib/govuk_publishing_components/version.rb +1 -1
  102. data/node_modules/govuk-frontend/govuk/all.js +120 -49
  103. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +2 -2
  104. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +0 -2
  105. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +2 -2
  106. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +6 -16
  107. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +2 -2
  108. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +120 -49
  109. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +33 -17
  110. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +2 -2
  111. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -4
  112. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +3 -2
  113. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +22 -10
  114. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
  115. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +23 -23
  116. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  117. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +4 -4
  118. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +2 -2
  119. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +3 -3
  120. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +2 -2
  121. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +12 -22
  122. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +13 -3
  123. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
  124. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +2 -2
  125. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -13
  126. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +5 -5
  127. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +2 -2
  128. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +2 -2
  129. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +1 -1
  130. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +4 -4
  131. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +2 -2
  132. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -4
  133. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +17 -12
  134. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +2 -2
  135. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -3
  136. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +2 -2
  137. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +5 -5
  138. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +4 -4
  139. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +2 -2
  140. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +2 -2
  141. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +2 -2
  142. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +3 -3
  143. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +7 -5
  144. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -2
  145. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  146. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -3
  147. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +2 -2
  148. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +10 -26
  149. data/node_modules/govuk-frontend/govuk/objects/_template.scss +1 -1
  150. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +0 -4
  151. data/node_modules/govuk-frontend/govuk/tools/_exports.scss +1 -1
  152. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
  153. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
  154. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +2 -2
  155. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  156. data/node_modules/govuk-frontend/govuk-esm/all.mjs +88 -0
  157. data/node_modules/govuk-frontend/govuk-esm/common.mjs +28 -0
  158. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +374 -0
  159. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +64 -0
  160. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +251 -0
  161. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +164 -0
  162. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +147 -0
  163. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +168 -0
  164. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +52 -0
  165. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +55 -0
  166. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +122 -0
  167. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +94 -0
  168. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +282 -0
  169. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.js +264 -0
  170. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.js +26 -0
  171. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.js +93 -0
  172. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.js +24 -0
  173. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.js +23 -0
  174. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.js +22 -0
  175. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.js +22 -0
  176. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.js +114 -0
  177. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.js +252 -0
  178. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.js +159 -0
  179. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.js +86 -0
  180. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.js +20 -0
  181. data/node_modules/govuk-frontend/package.json +8 -1
  182. metadata +30 -3
@@ -50,12 +50,19 @@
50
50
  // We use grid to split the container into column widths, so manage the horizontal spacing with
51
51
  // internal margins.
52
52
  margin: 0 govuk-spacing(3);
53
- padding: govuk-spacing(3) 0 govuk-spacing(6) 0;
53
+ padding: govuk-spacing(1) 0 govuk-spacing(4) 0;
54
+ }
55
+
56
+ .gem-c-cards__list-item-wrapper {
57
+ // this wrapper ensures that the clickable area of the card only
58
+ // covers the area of the card containing text so in a grid of cards
59
+ // there is space above and below each link
60
+ padding: govuk-spacing(2) govuk-spacing(6) govuk-spacing(2) 0;
54
61
  position: relative;
55
62
  }
56
63
 
57
64
  .gem-c-cards__sub-heading {
58
- margin: 0 govuk-spacing(6) govuk-spacing(2) 0;
65
+ margin-bottom: govuk-spacing(2);
59
66
  }
60
67
 
61
68
  .gem-c-cards__link {
@@ -79,7 +86,7 @@
79
86
  height: $dimension;
80
87
  position: absolute;
81
88
  right: govuk-spacing(1);
82
- top: govuk-spacing(4);
89
+ top: govuk-spacing(3);
83
90
  @include prefixed-transform($rotate: 45deg);
84
91
  width: $dimension;
85
92
  }
@@ -98,5 +105,5 @@
98
105
  }
99
106
 
100
107
  .gem-c-cards__description {
101
- margin: 0;
108
+ margin: 0 govuk-spacing(-6) 0 0;
102
109
  }
@@ -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;
@@ -16,7 +16,7 @@
16
16
  // This block is duplicated from Whitehall as a transitional step, see the
17
17
  // commit message for 2d893c10ee3f2cab27162b9aba38b12379a71d07 before making
18
18
  // changes, original version:
19
- // https://github.com/alphagov/whitehall/blob/master/app/assets/stylesheets/frontend/helpers/_attachment.scss
19
+ // https://github.com/alphagov/whitehall/blob/main/app/assets/stylesheets/frontend/helpers/_attachment.scss
20
20
  $thumbnail-width: 99px;
21
21
 
22
22
  .attachment {
@@ -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
- <li>Read about how to <a href="https://github.com/alphagov/govuk_publishing_components/blob/master/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 %>
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>
8
+ <li><a href="/component-guide/audit">View component audits</a></li>
27
9
  </ul>
28
10
  </div>
29
11
 
@@ -105,5 +87,5 @@
105
87
  </ul>
106
88
 
107
89
  <div class="component-markdown">
108
- <p class="govuk-body">If you cannot find a suitable component consider extending an existing component or <a href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/generate-a-new-component.md">creating a new one</a>.</p>
90
+ <p class="govuk-body">If you cannot find a suitable component consider extending an existing component or <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/generate-a-new-component.md">creating a new one</a>.</p>
109
91
  </div>
@@ -13,7 +13,7 @@
13
13
  <% if !@component_doc.accessibility_criteria.present? %>
14
14
  <div class="component-violation">
15
15
  <h2 class="component-violation__title">This component is not valid</h2>
16
- <a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a>
16
+ <a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a>
17
17
  </div>
18
18
  <% end %>
19
19
  <%= render 'govuk_publishing_components/components/lead_paragraph', text: @component_doc.description %>
@@ -31,17 +31,19 @@
31
31
  end
32
32
  %>
33
33
  <li class="gem-c-cards__list-item">
34
- <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %>
35
- <%=
36
- link_to link[:text], link[:path],
37
- class: "govuk-link gem-c-cards__link",
38
- data: link[:data_attributes],
39
- "data-track-count": "cardLink"
40
- %>
41
- <% end %>
42
- <% if item[:description] %>
43
- <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p>
44
- <% end %>
34
+ <div class="gem-c-cards__list-item-wrapper">
35
+ <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %>
36
+ <%=
37
+ link_to link[:text], link[:path],
38
+ class: "govuk-link gem-c-cards__link",
39
+ data: link[:data_attributes],
40
+ "data-track-count": "cardLink"
41
+ %>
42
+ <% end %>
43
+ <% if item[:description] %>
44
+ <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p>
45
+ <% end %>
46
+ </div>
45
47
  </li>
46
48
  <% end %>
47
49
  <% 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
- <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>
@@ -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 item.fetch(:edit, {}).any? %>
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 item.fetch(:delete, {}).any? %>
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
- <% else %>
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
- <% end %>
132
+
134
133
  <%= tag.div block, class: "gem-c-summary__block" if block %>
135
134
  <% end %>
136
135
  <% end %>
@@ -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 %>
@@ -191,7 +191,7 @@ examples:
191
191
  context:
192
192
  right_to_left: true
193
193
  with_branding:
194
- description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) for more details.
194
+ description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) for more details.
195
195
  data:
196
196
  brand: 'department-for-environment-food-rural-affairs'
197
197
  format_numbers: true