govuk_publishing_components 21.54.0 → 21.55.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/action-link--nhs.png +0 -0
  3. data/app/assets/images/govuk_publishing_components/action-link--nhs.svg +1 -0
  4. data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.png +0 -0
  5. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple.png +0 -0
  6. data/app/assets/images/govuk_publishing_components/action-link-arrow.png +0 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +38 -7
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +0 -38
  9. data/app/views/govuk_publishing_components/components/_action_link.html.erb +23 -3
  10. data/app/views/govuk_publishing_components/components/docs/action_link.yml +43 -15
  11. data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +1 -1
  12. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
  13. data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +7 -6
  14. data/lib/govuk_publishing_components/presenters/machine_readable/html_publication_schema.rb +77 -0
  15. data/lib/govuk_publishing_components/presenters/schema_org.rb +24 -16
  16. data/lib/govuk_publishing_components/version.rb +1 -1
  17. data/node_modules/govuk-frontend/README.md +6 -6
  18. data/node_modules/govuk-frontend/govuk/_base.scss +3 -0
  19. data/node_modules/govuk-frontend/govuk/all.js +1 -1
  20. data/node_modules/govuk-frontend/govuk/all.scss +1 -3
  21. data/node_modules/govuk-frontend/govuk/components/_all.scss +31 -29
  22. data/node_modules/govuk-frontend/govuk/components/accordion/_accordion.scss +2 -208
  23. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +207 -0
  24. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +1 -1
  25. data/node_modules/govuk-frontend/govuk/components/back-link/_back-link.scss +2 -65
  26. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +112 -0
  27. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_breadcrumbs.scss +2 -118
  28. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +138 -0
  29. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +6 -0
  30. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/template.njk +12 -1
  31. data/node_modules/govuk-frontend/govuk/components/button/_button.scss +2 -284
  32. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +280 -0
  33. data/node_modules/govuk-frontend/govuk/components/character-count/_character-count.scss +2 -31
  34. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +28 -0
  35. data/node_modules/govuk-frontend/govuk/components/checkboxes/_checkboxes.scss +2 -308
  36. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +304 -0
  37. data/node_modules/govuk-frontend/govuk/components/date-input/_date-input.scss +2 -30
  38. data/node_modules/govuk-frontend/govuk/components/date-input/_index.scss +26 -0
  39. data/node_modules/govuk-frontend/govuk/components/details/_details.scss +2 -88
  40. data/node_modules/govuk-frontend/govuk/components/details/_index.scss +84 -0
  41. data/node_modules/govuk-frontend/govuk/components/error-message/_error-message.scss +2 -15
  42. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +11 -0
  43. data/node_modules/govuk-frontend/govuk/components/error-summary/_error-summary.scss +2 -59
  44. data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +55 -0
  45. data/node_modules/govuk-frontend/govuk/components/fieldset/_fieldset.scss +2 -68
  46. data/node_modules/govuk-frontend/govuk/components/fieldset/_index.scss +64 -0
  47. data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +2 -81
  48. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +77 -0
  49. data/node_modules/govuk-frontend/govuk/components/footer/_footer.scss +2 -244
  50. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +238 -0
  51. data/node_modules/govuk-frontend/govuk/components/header/_header.scss +2 -318
  52. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +312 -0
  53. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +7 -1
  54. data/node_modules/govuk-frontend/govuk/components/header/template.njk +2 -2
  55. data/node_modules/govuk-frontend/govuk/components/hint/_hint.scss +2 -50
  56. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +46 -0
  57. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +99 -0
  58. data/node_modules/govuk-frontend/govuk/components/input/_input.scss +2 -103
  59. data/node_modules/govuk-frontend/govuk/components/inset-text/_index.scss +24 -0
  60. data/node_modules/govuk-frontend/govuk/components/inset-text/_inset-text.scss +2 -28
  61. data/node_modules/govuk-frontend/govuk/components/label/_index.scss +41 -0
  62. data/node_modules/govuk-frontend/govuk/components/label/_label.scss +2 -45
  63. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +40 -0
  64. data/node_modules/govuk-frontend/govuk/components/panel/_panel.scss +2 -44
  65. data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +27 -0
  66. data/node_modules/govuk-frontend/govuk/components/phase-banner/_phase-banner.scss +2 -31
  67. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +342 -0
  68. data/node_modules/govuk-frontend/govuk/components/radios/_radios.scss +2 -346
  69. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +53 -0
  70. data/node_modules/govuk-frontend/govuk/components/select/_select.scss +2 -57
  71. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +33 -0
  72. data/node_modules/govuk-frontend/govuk/components/skip-link/_skip-link.scss +2 -37
  73. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +153 -0
  74. data/node_modules/govuk-frontend/govuk/components/summary-list/_summary-list.scss +2 -157
  75. data/node_modules/govuk-frontend/govuk/components/table/_index.scss +50 -0
  76. data/node_modules/govuk-frontend/govuk/components/table/_table.scss +2 -54
  77. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +138 -0
  78. data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +2 -142
  79. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +87 -0
  80. data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +2 -91
  81. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +51 -0
  82. data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +2 -55
  83. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +56 -0
  84. data/node_modules/govuk-frontend/govuk/components/warning-text/_warning-text.scss +2 -60
  85. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +5 -3
  86. data/node_modules/govuk-frontend/govuk/core/_links.scss +5 -3
  87. data/node_modules/govuk-frontend/govuk/core/_lists.scss +17 -3
  88. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +5 -3
  89. data/node_modules/govuk-frontend/govuk/core/_template.scss +5 -3
  90. data/node_modules/govuk-frontend/govuk/core/_typography.scss +5 -3
  91. data/node_modules/govuk-frontend/govuk/helpers/_clearfix.scss +1 -1
  92. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  93. data/node_modules/govuk-frontend/govuk/helpers/_grid.scss +2 -1
  94. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +1 -1
  95. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +1 -1
  96. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  97. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +1 -1
  98. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +1 -1
  99. data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +1 -1
  100. data/node_modules/govuk-frontend/govuk/objects/_form-group.scss +1 -3
  101. data/node_modules/govuk-frontend/govuk/objects/_grid.scss +1 -3
  102. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +5 -3
  103. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +2 -4
  104. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +5 -3
  105. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +5 -3
  106. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +5 -3
  107. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +5 -3
  108. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +1 -1
  109. data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +1 -1
  110. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
  111. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +1 -1
  112. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
  113. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +1 -1
  114. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  115. data/node_modules/govuk-frontend/package.json +21 -21
  116. metadata +49 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f56d2e2736866df3cdbc9707a0add0da3bf84b188b3f4fdfeb1f1c7b522e5585
4
- data.tar.gz: 6a03e5093606f297e742415fa87adad884d4529d15ad91296ba7651934415b1c
3
+ metadata.gz: 67b6a6a998771d72bbbe83523102343350d083190a7c77e2bfd158d89104be3a
4
+ data.tar.gz: f64d56023c03cc92dc84dec30e06436e5904f98f2334e14440e4468886d27f55
5
5
  SHA512:
6
- metadata.gz: 7c463802fc7d7cf753bcae4d7501547af06be56fe0b1104587399834b439102da473a8b484d48b2e9a6d4c7baeed71ecf168118e30076ec9cc26f24fa51251b9
7
- data.tar.gz: ff4eaaa5ffd4e7b8e9fd071ac61b6aec2e0b316b17c3352372e44cba06fb58f740602bb6e0e56bbe031f6c21a80ff1db302ef0911abc130810904355d7698e0f
6
+ metadata.gz: a9fb15374f204846907e809baff835885ae63698064184bbe55b0dbe0c5fbf82ed0986595de7ebfdc62b50144ee0173c73c2b30f58468c72e1701745848f50c7
7
+ data.tar.gz: 30a0a5885f0bf9343d2bcb9679630829d394148447ee1041ff737704105b07ff4e28fd7711bee68ac604d7c864c6bd103606d7204ee2e010a94a0c9ebdd9a977
@@ -0,0 +1 @@
1
+ <svg fill="none" height="227" viewBox="0 0 227 227" width="227" xmlns="http://www.w3.org/2000/svg"><path d="m55.7 226.5c-30.4 0-55.2-24.8-55.2-55.2v-115.6c0-30.4 24.8-55.2 55.2-55.2h115.6c30.4 0 55.2 24.8 55.2 55.2v115.6c0 30.4-24.8 55.2-55.2 55.2z" fill="#0ba23b"/><path d="m171.3 1c30.2 0 54.7 24.5 54.7 54.7v115.6c0 30.2-24.5 54.7-54.7 54.7h-115.6c-30.2 0-54.7-24.5-54.7-54.7v-115.6c0-30.2 24.5-54.7 54.7-54.7zm0-1h-115.6c-30.7 0-55.7 25-55.7 55.7v115.6c0 30.7 25 55.7 55.7 55.7h115.6c30.7 0 55.7-25 55.7-55.7v-115.6c0-30.7-25-55.7-55.7-55.7z" fill="#0ba23b"/><path d="m113.5 52.7-.5-.3-112 112v6.9c0 7.3 1.5 14.3 4.1 20.7l107.9-107.9.5.3 108.2 108.2c2.8-6.5 4.3-13.8 4.3-21.3v-6.1z" fill="#fcf411"/><path d="m171.3 1h-3l57.7 57.7v-3c0-30.2-24.5-54.7-54.7-54.7z" fill="#fcf411"/><path d="m57.8 1h-2.1c-30.2 0-54.7 24.5-54.7 54.7v2.1z" fill="#fcf411"/><path d="m226 94.5-93.5-93.5h-38.8l-92.7 92.7v31.7l112-112 .5.3 112.5 112.5z" fill="#fcf411"/><path d="m205.8 213.8-92.3-92.3-.5-.3-92.2002 92.2c6 5 13.1 8.7 20.9 10.8l71.3002-71.3.5.3 71.1 71.1c7.9-1.9 15.1-5.6 21.2-10.5z" fill="#fcf411"/><path d="m112.1 188.3 1 1 .8-.8z" fill="#fcf411"/><path d="m149.8 226-36.7-36.7-36.7001 36.7z" fill="#fcf411"/><path d="m166.5 213.1h-106.0001c-25.7 0-46.6-20.9-46.6-46.6v-106c0-25.7 20.9-46.6 46.6-46.6h106.0001c25.7 0 46.6 20.9 46.6 46.6v106c0 25.7-20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.2 0-2.3-.2-3.4-.7s-2-1.1-2.9-2.1-1.5-2.1-2-3.4c-.5-1.4-.8-3-.8-4.8 0-1.7.2-3.2.7-4.6.4-1.4 1.1-2.5 1.9-3.5s1.9-1.7 3.1-2.2 2.7-.8 4.3-.8c2.2 0 4 .4 5.4 1.2s2.5 2 3.4 3.4c.8 1.4 1.4 3.1 1.8 5.1.3 1.9.5 4 .5 6.1 0 2.5-.2 4.9-.6 7.2s-1.1 4.3-2.1 6.1c-1 1.7-2.3 3.1-4 4.2s-3.8 1.6-6.4 1.6c-1.6 0-2.8-.1-3.9-.4-1-.3-1.8-.5-2.4-.8zm4.1-17.7c0 1.8.3 3.4 1 4.6s1.8 1.8 3.4 1.8c1.5 0 2.5-.6 3.3-1.7.7-1.1 1.1-2.7 1.1-4.6 0-2-.3-3.6-1-4.7s-1.8-1.7-3.3-1.7c-1.6 0-2.7.6-3.4 1.7-.7 1-1.1 2.6-1.1 4.6z"/></g></svg>
@@ -7,8 +7,8 @@
7
7
  width: 50px;
8
8
  height: 45px;
9
9
  // sass-lint:disable no-duplicate-properties
10
- background-image: image-url("govuk_publishing_components/action-link-arrow.png");
11
- background-image: image-url("govuk_publishing_components/action-link-arrow.svg");
10
+ background: image-url("govuk_publishing_components/action-link-arrow.png");
11
+ background: image-url("govuk_publishing_components/action-link-arrow.svg"), linear-gradient(transparent, transparent);
12
12
  // sass-lint:enable no-duplicate-properties
13
13
  background-repeat: no-repeat;
14
14
  background-position: 0 50%;
@@ -63,6 +63,20 @@
63
63
  }
64
64
  }
65
65
 
66
+ .gem-c-action-link--mobile-subtext {
67
+ .gem-c-action-link__subtext-wrapper {
68
+ display: block;
69
+ }
70
+
71
+ .gem-c-action-link__subtext {
72
+ padding: 0;
73
+
74
+ &:before {
75
+ display: none;
76
+ }
77
+ }
78
+ }
79
+
66
80
  .gem-c-action-link__subtext {
67
81
  @include govuk-font(19);
68
82
  display: block;
@@ -90,9 +104,10 @@
90
104
  width: 30px;
91
105
  height: 30px;
92
106
  // sass-lint:disable no-duplicate-properties
93
- background-image: image-url("govuk_publishing_components/action-link-arrow--simple.png");
94
- background-image: image-url("govuk_publishing_components/action-link-arrow--simple.svg");
107
+ background: image-url("govuk_publishing_components/action-link-arrow--simple.png");
108
+ background: image-url("govuk_publishing_components/action-link-arrow--simple.svg"), linear-gradient(transparent, transparent);
95
109
  // sass-lint:enable no-duplicate-properties
110
+ background-repeat: no-repeat;
96
111
  background-size: 25px auto;
97
112
  background-position: 0 2px;
98
113
  }
@@ -113,9 +128,10 @@
113
128
  width: 30px;
114
129
  height: 30px;
115
130
  // sass-lint:disable no-duplicate-properties
116
- background-image: image-url("govuk_publishing_components/action-link-arrow--dark.png");
117
- background-image: image-url("govuk_publishing_components/action-link-arrow--dark.svg");
131
+ background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
132
+ background: image-url("govuk_publishing_components/action-link-arrow--dark.svg"), linear-gradient(transparent, transparent);
118
133
  // sass-lint:enable no-duplicate-properties
134
+ background-repeat: no-repeat;
119
135
  background-size: 25px auto;
120
136
  background-position: 0 2px;
121
137
  }
@@ -125,10 +141,25 @@
125
141
  }
126
142
  }
127
143
 
144
+ .gem-c-action-link--nhs {
145
+ &:before {
146
+ width: 80px;
147
+ height: 70px;
148
+ // sass-lint:disable no-duplicate-properties
149
+ background: image-url("govuk_publishing_components/action-link--nhs.png");
150
+ background: image-url("govuk_publishing_components/action-link--nhs.svg"), linear-gradient(transparent, transparent);
151
+ // sass-lint:enable no-duplicate-properties
152
+ background-repeat: no-repeat;
153
+ background-size: 85% auto;
154
+ background-position: 0 50%;
155
+ }
156
+ }
157
+
128
158
  .gem-c-action-link--light-text {
129
159
  color: govuk-colour("white");
130
160
 
131
- .gem-c-action-link__link {
161
+ .gem-c-action-link__link,
162
+ .gem-c-action-link__subtext-link {
132
163
  text-decoration: underline;
133
164
 
134
165
  &:link,
@@ -1,39 +1 @@
1
1
  @import "govuk/components/back-link/back-link";
2
-
3
- .govuk-back-link {
4
- &[href] {
5
- text-decoration: underline;
6
- border-bottom: 1px solid transparent;
7
-
8
- &:focus {
9
- text-decoration: none;
10
- }
11
- }
12
-
13
- &:before {
14
- content: "";
15
- display: block;
16
- position: absolute;
17
- top: 0;
18
- bottom: 1px;
19
- left: 3px;
20
- width: 7px;
21
- height: 7px;
22
- -webkit-transform: rotate(225deg);
23
- -ms-transform: rotate(225deg);
24
- transform: rotate(225deg);
25
- border: solid;
26
- border-width: 1px 1px 0 0;
27
- clip-path: inherit;
28
- -webkit-clip-path: inherit;
29
- }
30
- }
31
-
32
- .govuk-back-link::after {
33
- content: "";
34
- position: absolute;
35
- top: -14px;
36
- right: 0;
37
- left: 0;
38
- bottom: -14px;
39
- }
@@ -6,34 +6,54 @@
6
6
  nowrap_text ||= false
7
7
  href ||= false
8
8
  subtext ||= false
9
+ subtext_href ||= false
10
+ mobile_subtext ||= false
9
11
  light_text ||= false
10
12
  simple ||= false
11
13
  dark_icon ||= false
14
+ nhs_icon ||= false
12
15
  data ||= nil
13
16
  classes ||= nil
14
17
 
15
18
  css_classes = %w(gem-c-action-link)
16
19
  css_classes << "gem-c-action-link--light-text" if light_text
17
20
  css_classes << "gem-c-action-link--dark-icon" if dark_icon
21
+ css_classes << "gem-c-action-link--nhs" if nhs_icon
18
22
  css_classes << "gem-c-action-link--simple" if simple
19
23
  css_classes << "gem-c-action-link--with-subtext" if subtext
24
+ css_classes << "gem-c-action-link--mobile-subtext" if mobile_subtext
20
25
  css_classes << (shared_helper.get_margin_bottom)
21
26
 
22
27
  link_classes = %w(govuk-link gem-c-action-link__link)
23
28
  link_classes << shared_helper.classes if classes
24
29
  %>
25
- <% if href.present? && text.present? %>
30
+ <% if text.present? %>
26
31
  <div class="<%= css_classes.join(' ') %>">
27
32
  <% contents = capture do %>
28
33
  <span class="gem-c-action-link__link-wrapper">
29
- <%= link_to href, :class => link_classes, :data => data do %>
34
+ <% main_text = capture do %>
30
35
  <%= text %>
31
36
  <%= content_tag(:span, nowrap_text, class: "gem-c-action-link__nowrap-text") if nowrap_text %>
32
37
  <% end %>
38
+
39
+ <% if href.present? %>
40
+ <%= link_to href, class: link_classes, data: data do %>
41
+ <%= main_text %>
42
+ <% end %>
43
+ <% else %>
44
+ <%= main_text %>
45
+ <% end %>
33
46
  </span>
47
+
34
48
  <% if subtext %>
35
49
  <span class="gem-c-action-link__subtext-wrapper">
36
- <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %>
50
+ <% if subtext_href %>
51
+ <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") do %>
52
+ <%= link_to subtext, subtext_href, class: "gem-c-action-link__subtext-link govuk-link", data: data %>
53
+ <% end %>
54
+ <% else %>
55
+ <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %>
56
+ <% end %>
37
57
  </span>
38
58
  <% end %>
39
59
  <% end %>
@@ -6,56 +6,84 @@ examples:
6
6
  default:
7
7
  data:
8
8
  text: Go to NHS 111 online
9
- href: '/my-test-page'
9
+ href: "/page"
10
10
  with_bottom_margin:
11
11
  data:
12
12
  text: Look at this margin
13
- href: '/my-test-page'
13
+ href: "/page"
14
14
  margin_bottom: 9
15
15
  with_data_attributes:
16
16
  data:
17
17
  text: "Coronavirus (COVID-19)"
18
- href: '/my-test-page'
18
+ href: "/page"
19
19
  data:
20
20
  attr_test: "hasDataAttribute"
21
21
  with_js_classes:
22
22
  description: Use `js-` prefixed classes only as interaction hooks – to query and operate on elements via JavaScript. Classes are added to the link itself.
23
23
  data:
24
24
  text: "Coronavirus (COVID-19)"
25
- href: '/my-test-page'
25
+ href: "/page"
26
26
  classes: 'js-hook'
27
27
  with_no_wrapping_text:
28
28
  data:
29
29
  text: "Coronavirus (COVID-19):"
30
30
  nowrap_text: what you need to do
31
- href: '/my-test-page'
31
+ href: "/page"
32
32
  with_light_text:
33
33
  data:
34
34
  text: "Coronavirus (COVID-19)"
35
- href: '/my-test-page'
35
+ href: "/page"
36
36
  light_text: true
37
37
  context:
38
38
  dark_background: true
39
39
  with_subtext:
40
40
  data:
41
- text: "Emergency something"
42
- href: '/page'
43
- subtext: "This is about the emergency"
41
+ text: Emergency something
42
+ href: "/page"
43
+ subtext: This is about the emergency
44
44
  with_subtext_on_a_dark_background:
45
45
  data:
46
- text: "Emergency something"
47
- href: '/page'
48
- subtext: "This is about the emergency that is happening right now unfortunately so pay attention"
46
+ text: Emergency something
47
+ href: "/page"
48
+ subtext: This is about the emergency that is happening right now unfortunately so pay attention
49
+ light_text: true
50
+ context:
51
+ dark_background: true
52
+ mobile_subtext:
53
+ description: Lock the subtext beneath the main text, so the component with subtext always appears as it does on mobile.
54
+ data:
55
+ text: Try not to panic now
56
+ href: "/page"
57
+ subtext: "The thing that is happening is pretty scary but we'll get through it"
58
+ mobile_subtext: true
59
+ with_link_on_subtext:
60
+ description: The subtext can also be a link if required. The link on the main text is optional.
61
+ data:
62
+ text: Remain calm
63
+ subtext: Better things are ahead
64
+ subtext_href: "/page"
65
+ with_link_on_subtext_on_a_dark_background:
66
+ data:
67
+ text: Remain calm
68
+ subtext: Better things are ahead
69
+ subtext_href: "/page"
49
70
  light_text: true
50
71
  context:
51
72
  dark_background: true
52
73
  simple_arrow:
53
74
  data:
54
- text: "Getting financial help and keeping your business safe"
75
+ text: Getting financial help and keeping your business safe
55
76
  href: "/financial-help"
56
77
  simple: true
57
78
  with_dark_icon:
58
79
  data:
59
- text: "Coronavirus (COVID-19)"
60
- href: '/my-test-page'
80
+ text: Coronavirus (COVID-19)
81
+ href: "/my-test-page"
61
82
  dark_icon: true
83
+ with_nhs_icon:
84
+ data:
85
+ text: Something about the NHS
86
+ subtext: Perhaps you'd like to click here
87
+ subtext_href: "/page"
88
+ mobile_subtext: true
89
+ nhs_icon: true
@@ -46,7 +46,7 @@ module GovukPublishingComponents
46
46
  end
47
47
 
48
48
  def output
49
- return content_item_options unless content_item_navigation.html_document_with_parent?
49
+ return content_item_options unless content_item_navigation.html_publication_with_parent?
50
50
  return parent_item_options if parent_item_navigation.priority_breadcrumbs
51
51
 
52
52
  step_by_step_header = parent_item_options[:step_by_step]
@@ -16,7 +16,7 @@ module GovukPublishingComponents
16
16
  content_item["document_type"] == "simple_smart_answer"
17
17
  end
18
18
 
19
- def html_document_with_parent?
19
+ def html_publication_with_parent?
20
20
  (content_item["document_type"] == "html_publication") && parent_api_path
21
21
  end
22
22
 
@@ -24,9 +24,8 @@ module GovukPublishingComponents
24
24
  end
25
25
 
26
26
  def questions_and_answers_markup
27
- question_and_answers(page.body)
28
- .select { |_, value| value[:answer].present? }
29
- .map do |question, value|
27
+ question_and_answers.select { |_, value| value[:answer].present? }
28
+ .map do |question, value|
30
29
  q_and_a_url = section_url(value[:anchor])
31
30
 
32
31
  {
@@ -52,9 +51,7 @@ module GovukPublishingComponents
52
51
  #
53
52
  # - :anchor: the id of the h2 (autogenerated by the markdown converter).
54
53
  # This is used to build links directly to the section in question
55
- def question_and_answers(html)
56
- doc = Nokogiri::HTML(html)
57
-
54
+ def question_and_answers
58
55
  question = page.title
59
56
 
60
57
  doc.xpath("html/body").children.each_with_object({}) do |element, q_and_as|
@@ -71,6 +68,10 @@ module GovukPublishingComponents
71
68
  end
72
69
  end
73
70
 
71
+ def doc
72
+ @doc ||= Nokogiri::HTML(page.body)
73
+ end
74
+
74
75
  def question_hash_is_unset?(q_and_as, question)
75
76
  q_and_as[question].nil?
76
77
  end
@@ -0,0 +1,77 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class HtmlPublicationSchema < FaqPageSchema
4
+ attr_reader :page
5
+
6
+ def initialize(page)
7
+ @page = page
8
+ end
9
+
10
+ def structured_data
11
+ return ArticleSchema.new(page).structured_data if less_than_two_headings_of_any_one_type?
12
+
13
+ super
14
+ end
15
+
16
+ def heading_counts
17
+ @heading_counts ||= (1..5).each_with_object({}) do |n, hash|
18
+ heading = "h#{n}"
19
+ hash[heading] = doc.xpath("//*[@class=\"govspeak\"]//#{heading}").count
20
+ end
21
+ end
22
+
23
+ def less_than_two_headings_of_any_one_type?
24
+ heading_counts.values.max < 2
25
+ end
26
+
27
+ def question_and_answers
28
+ headings.each_with_object({}) do |heading, hash|
29
+ question = heading.text
30
+
31
+ next_heading = heading_pairs[heading]
32
+ next_heading_path = next_heading && next_heading.path
33
+ answer = content_between(heading.path, next_heading_path)
34
+
35
+ hash[question] = {
36
+ answer: answer.map(&:to_s).join,
37
+ anchor: heading.attr(:id),
38
+ }
39
+ end
40
+ end
41
+
42
+ def headings
43
+ @headings ||= doc.xpath("//*[@class=\"govspeak\"]//#{first_heading_type_with_more_than_one_occurance}")
44
+ end
45
+
46
+ def first_heading_type_with_more_than_one_occurance
47
+ heading_counts.detect { |_k, v| v > 1 }.first
48
+ end
49
+
50
+ def heading_pairs
51
+ @heading_pairs ||= pairs_hash(headings)
52
+ end
53
+
54
+ # Converts [:a, :b, :c] into
55
+ # {:a => :b, :b => :c}
56
+ def pairs_hash(array)
57
+ all_but_last = array[0..-2]
58
+ all_but_first = array[1..-1]
59
+ pairs = [all_but_last, all_but_first].transpose
60
+ Hash[pairs]
61
+ end
62
+
63
+ # From: https://stackoverflow.com/a/7816046/1014251
64
+ # If `stop_xpath` is `nil` gets text to end of content
65
+ def content_between(start_xpath, stop_xpath = nil)
66
+ node = doc.at_xpath(start_xpath).next_element
67
+ stop = stop_xpath && doc.at_xpath(stop_xpath)
68
+ [].tap do |content|
69
+ while node && node != stop
70
+ content << node
71
+ node = node.next_element
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -4,6 +4,7 @@ require "govuk_publishing_components/presenters/machine_readable/creative_work_s
4
4
  require "govuk_publishing_components/presenters/machine_readable/faq_page_schema"
5
5
  require "govuk_publishing_components/presenters/machine_readable/government_service_schema"
6
6
  require "govuk_publishing_components/presenters/machine_readable/has_part_schema"
7
+ require "govuk_publishing_components/presenters/machine_readable/html_publication_schema"
7
8
  require "govuk_publishing_components/presenters/machine_readable/is_part_of_schema"
8
9
  require "govuk_publishing_components/presenters/machine_readable/news_article_schema"
9
10
  require "govuk_publishing_components/presenters/machine_readable/organisation_schema"
@@ -22,22 +23,29 @@ module GovukPublishingComponents
22
23
  end
23
24
 
24
25
  def structured_data
25
- if page.schema == :faq
26
- FaqPageSchema.new(page).structured_data
27
- elsif page.schema == :article
28
- ArticleSchema.new(page).structured_data
29
- elsif page.schema == :government_service
30
- GovernmentServiceSchema.new(page).structured_data
31
- elsif page.schema == :news_article
32
- NewsArticleSchema.new(page).structured_data
33
- elsif page.schema == :person
34
- PersonSchema.new(page).structured_data
35
- elsif page.schema == :organisation
36
- OrganisationSchema.new(page).structured_data
37
- elsif page.schema == :search_results_page
38
- SearchResultsPageSchema.new(page).structured_data
39
- elsif page.schema == :dataset
40
- DatasetSchema.new(page).structured_data
26
+ schema_for_page.new(page).structured_data
27
+ end
28
+
29
+ def schema_for_page
30
+ case page.schema
31
+ when :faq
32
+ FaqPageSchema
33
+ when :article
34
+ ArticleSchema
35
+ when :government_service
36
+ GovernmentServiceSchema
37
+ when :news_article
38
+ NewsArticleSchema
39
+ when :person
40
+ PersonSchema
41
+ when :organisation
42
+ OrganisationSchema
43
+ when :search_results_page
44
+ SearchResultsPageSchema
45
+ when :dataset
46
+ DatasetSchema
47
+ when :html_publication
48
+ HtmlPublicationSchema
41
49
  else
42
50
  raise "#{page.schema} is not supported"
43
51
  end