govuk_publishing_components 25.6.0 → 27.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +2 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +41 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss +10 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +4 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +1 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +128 -4
  9. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_images.scss +1 -0
  10. data/app/views/govuk_publishing_components/components/_big_number.html.erb +35 -0
  11. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +23 -0
  12. data/app/views/govuk_publishing_components/components/_document_list.html.erb +1 -1
  13. data/app/views/govuk_publishing_components/components/_image_card.html.erb +14 -10
  14. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -2
  15. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/docs/big_number.yml +50 -0
  17. data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +81 -0
  18. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +11 -0
  19. data/app/views/govuk_publishing_components/components/docs/image_card.yml +28 -12
  20. data/app/views/govuk_publishing_components/components/layout_for_public/_account-feedback-footer.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb +3 -3
  23. data/config/locales/en.yml +10 -2
  24. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +27 -0
  25. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +5 -5
  26. data/lib/govuk_publishing_components/version.rb +1 -1
  27. data/lib/govuk_publishing_components.rb +2 -0
  28. metadata +25 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1b20d5bd22562106adb11d4dae477700ae7cf87c10e8113615ddccc43a57eee
4
- data.tar.gz: 6c8cbab6a211c1d7192af9128ea910b9394702a7d369e1b48e29d74f541ce4a4
3
+ metadata.gz: 6ea0bb81f01cfea5a7fbefd1883bc66bbcb8a150d18dbce3a19848c9f86752c7
4
+ data.tar.gz: b2f8ef623497037c2f169c0455831aa7d2c0126f3ece9b05800486a1c283b2c5
5
5
  SHA512:
6
- metadata.gz: 298e4ac11183bbd0dc6dd364c9d831143c5b94e92b65e3afccad59269c1515e683834db2e3af528f7c2416c78a644cbd61aba803b66e65335195f8bc1e4dfd76
7
- data.tar.gz: 71429d6099fcc7465c2fef3092fb9b586f385c399e1f90a71470a433d91d2f25314ed53e10b543a683cb3c94c7b8bcb44a272c5a3e479faab9a8f581e9405902
6
+ metadata.gz: 4aef038f59352ee50197fc9a1e35f95d5ff7c56a3f4182341a866301ea39643d94cf3db806d669135299db0b614cc1d8ddfb28aef8fd11a5d067703f717a4213
7
+ data.tar.gz: 1234faee1167e829e7e887599f9f47d5bf5c8eb1ee7dd228b3afbd058a17e5f67fed95103b1e511ef7ca76b8ebaec9b253a0b3f8706ddbcc4562a990d2b843c0
@@ -16,6 +16,7 @@ $govuk-new-link-styles: true;
16
16
  @import "components/attachment";
17
17
  @import "components/attachment-link";
18
18
  @import "components/back-link";
19
+ @import "components/big-number";
19
20
  @import "components/breadcrumbs";
20
21
  @import "components/button";
21
22
  @import "components/character-count";
@@ -27,6 +28,7 @@ $govuk-new-link-styles: true;
27
28
  @import "components/copy-to-clipboard";
28
29
  @import "components/date-input";
29
30
  @import "components/details";
31
+ @import "components/devolved-nations";
30
32
  @import "components/document-list";
31
33
  @import "components/error-alert";
32
34
  @import "components/error-message";
@@ -0,0 +1,41 @@
1
+ .gem-c-big-number {
2
+ margin-bottom: govuk-spacing(3);
3
+ }
4
+
5
+ .gem-c-big-number__value {
6
+ @include govuk-font($size: 80, $weight: bold);
7
+ }
8
+
9
+ .gem-c-big-number__label {
10
+ @include govuk-font($size: 16, $weight: bold, $line-height: 2);
11
+
12
+ // This pseudo element is to bypass an issue with NVDA where block level elements are dictated separately.
13
+ // What's happening here is that the label and the number technically have an inline relationship but appear to have a block relationship thanks to this element
14
+ &:before {
15
+ content: "";
16
+ display: block;
17
+ }
18
+ }
19
+
20
+ .gem-c-big-number__link {
21
+ display: inline-block;
22
+ text-decoration: none;
23
+
24
+ // Add govuk-link hover decoration to main value if no label present but a href attribute is
25
+ .gem-c-big-number__value--decorated {
26
+ @include govuk-link-decoration;
27
+ @include govuk-link-style-no-underline;
28
+ }
29
+
30
+ .gem-c-big-number__label {
31
+ @include govuk-link-decoration;
32
+ }
33
+
34
+ &:hover,
35
+ &:active {
36
+ .gem-c-big-number__label,
37
+ .gem-c-big-number__value--decorated {
38
+ @include govuk-link-hover-decoration;
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,10 @@
1
+ .gem-c-devolved-nations {
2
+ background: govuk-colour("light-grey");
3
+ margin-bottom: govuk-spacing(3);
4
+ padding: govuk-spacing(3);
5
+
6
+ @include govuk-media-query($from: desktop) {
7
+ margin-bottom: govuk-spacing(8);
8
+ padding: govuk-spacing(4) govuk-spacing(6);
9
+ }
10
+ }
@@ -107,6 +107,8 @@
107
107
 
108
108
  .gem-c-document-list__children {
109
109
  margin-bottom: 0;
110
+ padding-left: 0;
111
+ list-style-type: none;
110
112
 
111
113
  @include govuk-media-query($from: desktop) {
112
114
  margin-left: govuk-spacing(4);
@@ -127,6 +127,10 @@
127
127
  margin-bottom: govuk-spacing(1);
128
128
  }
129
129
 
130
+ .gem-c-image-card__list-item--text {
131
+ color: govuk-colour("dark-grey", $legacy: "grey-1");
132
+ }
133
+
130
134
  .gem-c-image-card__list-item-link {
131
135
  line-height: 1.35em;
132
136
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  .js-enabled .gem-c-layout-for-public__global-banner-wrapper {
11
11
  margin-top: - govuk-spacing(2);
12
+ min-height: govuk-spacing(2);
12
13
  position: relative;
13
14
  }
14
15
 
@@ -1,3 +1,97 @@
1
+ /// Set grid row or column value using the fraction unit.
2
+ ///
3
+ /// @param {Integer} $number - number of fractions that the grid row or column
4
+ /// needs to be divided into.
5
+ /// @returns {String} - the value
6
+ ///
7
+ /// @example scss - Five fractions will return `1fr 1fr 1fr 1fr 1fr`.
8
+ /// .container {
9
+ /// grid-template-rows: fractions(5);
10
+ /// }
11
+ ///
12
+ @function fractions($number) {
13
+ $fractions: "1fr";
14
+
15
+ @for $i from 1 to $number {
16
+ $fractions: $fractions + " 1fr";
17
+ }
18
+
19
+ @return unquote($fractions);
20
+ }
21
+
22
+ /// Arrange items into vertical columns
23
+ ///
24
+ /// @param {Integer} $items - number of items that need to be arranged
25
+ /// @param {Integer} $columns - number of columns required
26
+ /// @param {String} $selector - (optional) the inner element to be targeted.
27
+ ///
28
+ /// @example scss - A 7 item 2 column layout.
29
+ /// .container {
30
+ /// @include columns(7, 2);
31
+ /// }
32
+
33
+ /// @example scss - A 9 item 3 column layout that has `div`s as the inner
34
+ /// elements.
35
+ /// .container {
36
+ /// @include columns(9, 3, "div");
37
+ /// }
38
+ ///
39
+ @mixin columns($items, $columns, $selector: "*") {
40
+ $rows: ceil($items / $columns);
41
+
42
+ display: -ms-grid;
43
+ display: grid;
44
+ grid-auto-flow: column;
45
+ -ms-grid-columns: fractions($columns);
46
+ grid-template-columns: fractions($columns);
47
+ -ms-grid-rows: fractions($rows);
48
+ grid-template-rows: fractions($rows);
49
+
50
+ // Internet Explorer 10-11 require each element to be placed in the grid -
51
+ // the `grid-auto-flow` property isn't supported. This means that both the
52
+ // column and row needs to be set for every element.
53
+
54
+ // This creates a list of lists to represent the columns and rows; for
55
+ // example, a 7 item 2 column list would create this:
56
+ // [
57
+ // [1, 2, 3, 4 ] // column one
58
+ // [5, 6, 7] // column two
59
+ // ]
60
+ $grid: ();
61
+ $counter: 0;
62
+
63
+ @for $column from 1 through $columns {
64
+ $this-row: ();
65
+
66
+ @for $row from 1 through $rows {
67
+ $counter: $counter + 1;
68
+
69
+ @if $counter <= $items {
70
+ $this-row: append($this-row, $counter);
71
+ }
72
+ }
73
+
74
+ $grid: append($grid, $this-row, "comma");
75
+ }
76
+
77
+ // Now we can loop through the list of lists to create the rules needed for
78
+ // the older grid syntax; fist looping through the list to get the number
79
+ // needed for the column, then looping again to get the number for the grid
80
+ // row:
81
+ @for $column_index from 1 through length($grid) {
82
+ $this-row: nth($grid, $column_index);
83
+
84
+ @for $item-index from 1 through length($this-row) {
85
+ $this-item: nth($this-row, $item-index);
86
+
87
+ & > #{$selector}:nth-child(#{$this-item}) {
88
+ -ms-grid-column: $column_index;
89
+ -ms-grid-row: $item-index;
90
+ }
91
+ }
92
+ }
93
+ }
94
+
1
95
  $search-icon-size: 20px;
2
96
 
3
97
  @mixin chevron($colour) {
@@ -431,6 +525,26 @@ $search-icon-size: 20px;
431
525
  content: " ";
432
526
  }
433
527
  }
528
+
529
+ // To avoid the 'sticky hover' problem, we need to stop the hover state on
530
+ // touch screen devices.
531
+ //
532
+ // One solution is to use `@media(hover: hover)`. This turns on the hover
533
+ // state only for devices that aren't touchscreen, but means that browsers
534
+ // that don't support this media query won't get a hover state at all.
535
+ //
536
+ // To get around this, we do the opposite - we turn off the hover state for
537
+ // for touchscreen devices.
538
+ @media (hover: none), (pointer: coarse) {
539
+ &:not(:focus):hover {
540
+ background-color: $govuk-link-colour;
541
+ color: govuk-colour("white");
542
+
543
+ &:after {
544
+ background-color: $govuk-link-colour;
545
+ }
546
+ }
547
+ }
434
548
  }
435
549
  }
436
550
 
@@ -579,8 +693,6 @@ $search-icon-size: 20px;
579
693
  padding: govuk-spacing(2) 0 govuk-spacing(6) 0;
580
694
 
581
695
  @include govuk-media-query($from: "desktop") {
582
- display: flex;
583
- flex-wrap: wrap;
584
696
  margin-left: (0 - govuk-spacing(3));
585
697
  margin-right: (0 - govuk-spacing(3));
586
698
  padding: govuk-spacing(6) 0 govuk-spacing(8) 0;
@@ -590,11 +702,23 @@ $search-icon-size: 20px;
590
702
  margin-bottom: 0;
591
703
  padding-left: govuk-spacing(3);
592
704
  padding-right: govuk-spacing(3);
593
- width: 50%;
594
705
  }
595
706
  }
596
707
  }
597
708
 
709
+ .gem-c-layout-super-navigation-header__navigation-second-items--topics {
710
+ @include govuk-media-query($from: "desktop") {
711
+ @include columns(18, 2, "li");
712
+ }
713
+ }
714
+
715
+ .gem-c-layout-super-navigation-header__navigation-second-items--government-activity {
716
+ @include govuk-media-query($from: "desktop") {
717
+ @include columns(5, 2, "li");
718
+ padding-bottom: govuk-spacing(3);
719
+ }
720
+ }
721
+
598
722
  .gem-c-layout-super-navigation-header__navigation-second-item-link {
599
723
  display: inline-block;
600
724
  padding: govuk-spacing(2) 0;
@@ -608,8 +732,8 @@ $search-icon-size: 20px;
608
732
 
609
733
  .gem-c-layout-super-navigation-header__navigation-second-item-link--with-description {
610
734
  @include govuk-font($size: 19, $weight: bold);
735
+ margin-top: govuk-spacing(2);
611
736
  margin-bottom: 0;
612
- padding-bottom: govuk-spacing(1);
613
737
  }
614
738
 
615
739
  // Dropdown menu footer links.
@@ -17,6 +17,7 @@
17
17
  clear: both;
18
18
  overflow: hidden;
19
19
  padding: govuk-spacing(2) 0 0;
20
+ margin: 0;
20
21
 
21
22
  img {
22
23
  display: inline;
@@ -0,0 +1,35 @@
1
+ <%
2
+ href ||= nil
3
+ number ||= nil
4
+ label ||= nil
5
+ href ||= nil
6
+ data_attributes ||= nil
7
+ classes = ["gem-c-big-number__value"]
8
+
9
+ if label.nil? && href
10
+ classes << "gem-c-big-number__value--decorated"
11
+ end
12
+ %>
13
+ <% if number %>
14
+ <% big_number_value = capture do %>
15
+ <%= tag.span class: classes do %>
16
+ <%= number %>
17
+ <% end %>
18
+
19
+ <% unless label.nil? %>
20
+ <% # add a virtual space here to handle screen readers printing dictations without a space between the number and the label %>
21
+ <span class="govuk-visually-hidden">&nbsp;</span>
22
+ <span class="gem-c-big-number__label">
23
+ <%= label %>
24
+ </span>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <%= tag.div class: "gem-c-big-number" do %>
29
+ <% unless href.nil? %>
30
+ <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: data_attributes %>
31
+ <% else %>
32
+ <%= big_number_value %>
33
+ <% end %>
34
+ <% end %>
35
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%
2
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
+ devolved_nations_helper = GovukPublishingComponents::Presenters::DevolvedNationsHelper.new(local_assigns)
4
+
5
+ applies_to ||= t('components.devolved_nations.applies_to')
6
+ heading_level ||= 2
7
+ %>
8
+
9
+ <% if national_applicability.any? { |k,v| v[:applicable] == true } %>
10
+ <%= tag.section class: "gem-c-devolved-nations" do %>
11
+ <%= content_tag(shared_helper.get_heading_level, class: "govuk-heading-s govuk-!-margin-bottom-0") do %>
12
+ <%= applies_to %> <%= devolved_nations_helper.applicable_nations_title_text %>
13
+ <% end %>
14
+
15
+ <% if devolved_nations_helper.nations_with_urls.any? %>
16
+ <%= content_tag :ul, class: "govuk-list govuk-!-margin-top-1 govuk-!-margin-bottom-0" do -%>
17
+ <% devolved_nations_helper.nations_with_urls.each do |k, v| %>
18
+ <%= content_tag(:li, link_to("Guidance for #{t("components.devolved_nations.#{k}")}", v[:alternative_url], class: "govuk-link")) %>
19
+ <% end %>
20
+ <% end %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
@@ -92,7 +92,7 @@
92
92
  <% end %>
93
93
 
94
94
  <% if item[:parts] && item[:parts].any? %>
95
- <ul class="gem-c-document-list__children govuk-list">
95
+ <ul class="gem-c-document-list__children">
96
96
  <% item[:parts].each do |part| %>
97
97
  <li class="gem-c-document-list-child">
98
98
  <%=
@@ -23,7 +23,7 @@
23
23
  extra_link_classes << brand_helper.color_class
24
24
 
25
25
  %>
26
- <% if card_helper.href || card_helper.extra_links.any? %>
26
+ <% if card_helper.href || card_helper.extra_details.any? %>
27
27
  <div class="<%= classes %> <%= brand_helper.brand_class %>"
28
28
  <%= "data-module=gem-track-click" if card_helper.is_tracking? %>
29
29
  <%= "lang=#{card_helper.lang}" if card_helper.lang %>>
@@ -44,15 +44,19 @@
44
44
  <%= card_helper.context %>
45
45
  </div>
46
46
  <%= card_helper.description %>
47
- <% if card_helper.extra_links.any? %>
48
- <ul class="gem-c-image-card__list <%= "gem-c-image-card__list--indented" if not card_helper.extra_links_no_indent %>">
49
- <% card_helper.extra_links.each do |link| %>
50
- <li class="gem-c-image-card__list-item">
51
- <%= link_to link[:text], link[:href],
52
- class: extra_link_classes,
53
- data: link[:data_attributes]
54
- %>
55
- </li>
47
+ <% if card_helper.extra_details.any? %>
48
+ <ul class="gem-c-image-card__list <%= "gem-c-image-card__list--indented" if not card_helper.extra_details_no_indent %>">
49
+ <% card_helper.extra_details.each do |link| %>
50
+ <li class="gem-c-image-card__list-item <%= "gem-c-image-card__list-item--text" if not link[:href].present? %>">
51
+ <% if link[:href].present? %>
52
+ <%= link_to link[:text], link[:href],
53
+ class: extra_link_classes,
54
+ data: link[:data_attributes]
55
+ %>
56
+ <% else %>
57
+ <%= link[:text] %>
58
+ <% end %>
59
+ </li>
56
60
  <% end %>
57
61
  </ul>
58
62
  <% end %>
@@ -44,8 +44,8 @@
44
44
  body_css_classes << "draft" if draft_watermark
45
45
  -%>
46
46
  <!DOCTYPE html>
47
- <!--[if lt IE 9]><html class="lte-ie8" lang="<%= html_lang %>"><![endif]-->
48
- <!--[if gt IE 8]><!--><html lang="<%= html_lang %>"><!--<![endif]-->
47
+ <!--[if lt IE 9]><html class="lte-ie8 govuk-template" lang="<%= html_lang %>"><![endif]-->
48
+ <!--[if gt IE 8]><!--><html class="govuk-template" lang="<%= html_lang %>"><!--<![endif]-->
49
49
  <head>
50
50
  <meta charset="utf-8" />
51
51
  <title><%= title %></title>
@@ -134,7 +134,7 @@ show_navigation_menu_text = t("components.layout_super_navigation_header.menu_to
134
134
  </div>
135
135
  <% if link[:menu_contents].present? %>
136
136
  <div class="govuk-grid-column-two-thirds-from-desktop">
137
- <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items">
137
+ <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items gem-c-layout-super-navigation-header__navigation-second-items--<%= link[:label].parameterize %>">
138
138
  <% link[:menu_contents].each do | item | %>
139
139
  <%
140
140
  has_description = item[:description].present?
@@ -0,0 +1,50 @@
1
+ name: Big number
2
+ description: A big number, with a label if needed, for visualising quantitative values such as the number of government departments or historical prime ministers.
3
+ body: |
4
+ This component requires at least a non-falsey `number` attribute value passed to it, otherwise it will not render.
5
+ accessibility_criteria: |
6
+ This component must:
7
+
8
+ - communicate number value and label (if present) in a single dictation when read with a screen reader
9
+ - convey the meaning of the number shown
10
+ shared_accessibility_criteria:
11
+ - link
12
+ examples:
13
+ default:
14
+ data:
15
+ number: 119
16
+ with_labels:
17
+ description: Labels for numbers are given inline styling but stacked using pseudo elements with display block. This is to bypass an issue with NVDA where block level elements are dictated separately.
18
+ data:
19
+ number: 119
20
+ label: Open consultations
21
+ passing_extra_symbols:
22
+ description: "In some cases, we want to communicate more than just the flat numeric value eg: 400+, 90%, -20, 1M etc. This is why we allow values to be passed as flat strings."
23
+ data:
24
+ number: "400+"
25
+ label: Other agencies and public bodies
26
+ with_link:
27
+ data:
28
+ number: 23
29
+ label: Ministerial departments
30
+ href: "/government/organisations#ministerial_departments"
31
+ with_link_but_no_label:
32
+ description: Numbers that are links are underlined unless a label is provided, in which case the label is given the underline.
33
+ data:
34
+ number: 23
35
+ href: "/government/organisations#ministerial_departments"
36
+ with_data_attributes:
37
+ description: |
38
+ These data attributes will only be present if a `href` attribute is present.
39
+
40
+ This will also not automatically apply a `gem-track-click` module attribute if the data attributes pertain to click tracking. Remember to apply this outside the component call in a surrounding element, if using.
41
+ data:
42
+ number: 23
43
+ label: Ministerial departments
44
+ href: "/government/organisations#ministerial_departments"
45
+ data_attributes:
46
+ track-category: homepageClicked
47
+ track-action: departmentsLink
48
+ track-label: "/government/organisations#ministerial_departments"
49
+ track-dimension: 23 Ministerial departments
50
+ track-dimension-index: 29
@@ -0,0 +1,81 @@
1
+ name: Devolved Nations (experimental)
2
+ description: A banner for linking to guidance for other nations.
3
+ body: |
4
+ The component replaces uses of the important metadata component for guidance for other nations.
5
+
6
+ The component can display:
7
+
8
+ * nations that the guidance relates to
9
+ * a list of alternative URLs where applicable
10
+ shared_accessibility_criteria:
11
+ - link
12
+ accessibility_criteria: |
13
+ The component must:
14
+
15
+ - Provide context for link text to highlight guidance is available.
16
+ examples:
17
+ default:
18
+ data:
19
+ national_applicability:
20
+ england:
21
+ applicable: true
22
+ applies_to_two_nations:
23
+ data:
24
+ national_applicability:
25
+ england:
26
+ applicable: true
27
+ wales:
28
+ applicable: true
29
+ applies_to_three_nations:
30
+ data:
31
+ national_applicability:
32
+ england:
33
+ applicable: true
34
+ scotland:
35
+ applicable: true
36
+ wales:
37
+ applicable: true
38
+ applies_to_one_nation_individual_guidance_available:
39
+ data:
40
+ national_applicability:
41
+ england:
42
+ applicable: true
43
+ scotland:
44
+ applicable: false
45
+ alternative_url: /
46
+ wales:
47
+ applicable: false
48
+ alternative_url: /
49
+ applies_to_one_nation_individual_guidance_available:
50
+ data:
51
+ national_applicability:
52
+ england:
53
+ applicable: true
54
+ northern_ireland:
55
+ applicable: false
56
+ alternative_url: /
57
+ scotland:
58
+ applicable: false
59
+ alternative_url: /
60
+ wales:
61
+ applicable: false
62
+ alternative_url: /
63
+ applies_to_three_nations_individual_guidance_available:
64
+ data:
65
+ national_applicability:
66
+ england:
67
+ applicable: true
68
+ northern_ireland:
69
+ applicable: false
70
+ alternative_url: /
71
+ scotland:
72
+ applicable: true
73
+ wales:
74
+ applicable: true
75
+ specific_heading level:
76
+ description: Use a different heading level for the main link title. Defaults to H2 if not passed.
77
+ data:
78
+ heading_level: 3
79
+ national_applicability:
80
+ england:
81
+ applicable: true
@@ -824,3 +824,14 @@ examples:
824
824
  <a role="button" class="gem-c-button govuk-button" href="https://gov.uk/random">Button</a>
825
825
  <a class="gem-c-button govuk-button govuk-button--start" role="button" href="https://gov.uk/random"> Start button <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" role="presentation" focusable="false"><path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path></svg></a>
826
826
  </p>
827
+ image:
828
+ data:
829
+ block: |
830
+ <figure class="image embedded">
831
+ <div class="img">
832
+ <img src="https://assets.publishing.service.gov.uk/government/uploads/system/uploads/image_data/file/40160/Picture2.jpg" alt="Open water with only mangrove stumps showing above the water. Credit: Blue Ventures-Garth Cripps">
833
+ </div>
834
+ <figcaption>
835
+ <p>Deforested area. Credit: Blue Ventures-Garth Cripps</p>
836
+ </figcaption>
837
+ </figure>
@@ -66,14 +66,14 @@ examples:
66
66
  text: "Press release"
67
67
  heading_text: "Government does things"
68
68
  description: "Following a thorough review of existing procedure, a government body has today announced that further work is necessary."
69
- with_extra_links:
69
+ with_extra_details:
70
70
  data:
71
71
  href: "/a-page-no-just-kidding"
72
72
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
73
73
  image_alt: "some meaningful alt text please"
74
74
  heading_text: "Some more links"
75
75
  description: "Greater transparency across government is at the heart of our commitment to let you hold politicians and public bodies to account."
76
- extra_links: [
76
+ extra_details: [
77
77
  {
78
78
  text: "Single departmental plans",
79
79
  href: "/1"
@@ -87,7 +87,7 @@ examples:
87
87
  href: "/3"
88
88
  },
89
89
  ]
90
- extra_links_without_indent:
90
+ extra_details_without_indent:
91
91
  description: Don't indent the extra links. Used for links to people pages.
92
92
  data:
93
93
  href: "/government/people/"
@@ -96,20 +96,36 @@ examples:
96
96
  context:
97
97
  text: "The Rt Hon"
98
98
  heading_text: "John Whiskers MP"
99
- extra_links: [
99
+ extra_details: [
100
100
  {
101
101
  text: "Minister for Cats",
102
102
  href: "/government/ministers/"
103
103
  }
104
104
  ]
105
- extra_links_no_indent: true
106
- extra_links_with_no_main_link:
105
+ extra_details_no_indent: true
106
+ extra_details_with_no_links:
107
+ description: If `extra_details` are passed to the component without `href` attributes, they are displayed as a simple text list.
108
+ data:
109
+ href: "/government/people/"
110
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
111
+ image_alt: "some meaningful alt text please"
112
+ heading_text: "John Whiskers MP"
113
+ extra_details: [
114
+ {
115
+ text: "Conservative 2010 to 2016",
116
+ },
117
+ {
118
+ text: "Labour 2007 to 2010",
119
+ }
120
+ ]
121
+ extra_details_no_indent: true
122
+ extra_details_with_no_main_link:
107
123
  description: If extra links are included, the main link is not needed. Note that in this configuration the image is not a link as no link has been supplied.
108
124
  data:
109
125
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
110
126
  image_alt: "some meaningful alt text please"
111
127
  heading_text: "John Whiskers MP"
112
- extra_links: [
128
+ extra_details: [
113
129
  {
114
130
  text: "Minister for Cats",
115
131
  href: "/government/ministers/"
@@ -129,7 +145,7 @@ examples:
129
145
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
130
146
  image_alt: "some meaningful alt text please"
131
147
  description: Here are some links to more information about the thing you are reading about.
132
- extra_links: [
148
+ extra_details: [
133
149
  {
134
150
  text: "More information",
135
151
  href: "/1"
@@ -158,7 +174,7 @@ examples:
158
174
  image_alt: "some meaningful alt text please"
159
175
  heading_text: "Something relating to this"
160
176
  description: "Public reform committee consultation vote department interior minister referendum."
161
- extra_links: [
177
+ extra_details: [
162
178
  {
163
179
  text: "Something",
164
180
  href: "/1"
@@ -194,7 +210,7 @@ examples:
194
210
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
195
211
  image_alt: "some meaningful alt text please"
196
212
  heading_text: "A link with tracking"
197
- extra_links: [
213
+ extra_details: [
198
214
  {
199
215
  text: "Another link with tracking",
200
216
  href: "/1",
@@ -219,13 +235,13 @@ examples:
219
235
  text: "The Rt Hon"
220
236
  heading_text: "John Whiskers MP"
221
237
  metadata: "Unpaid"
222
- extra_links: [
238
+ extra_details: [
223
239
  {
224
240
  text: "Minister for Cats",
225
241
  href: "/government/ministers/"
226
242
  }
227
243
  ]
228
- extra_links_no_indent: true
244
+ extra_details_no_indent: true
229
245
  with_lang:
230
246
  description: |
231
247
  Pass through an appropriate `lang` to set a HTML lang attribute for the component.
@@ -9,7 +9,7 @@
9
9
 
10
10
  <p class="govuk-body govuk-!-margin-bottom-0">
11
11
  <%= t("components.layout_for_public.account_layout.feedback.banners.footer_intro") %>
12
- <a href="<%= "#{Plek.find('account-manager')}/feedback" %>" class="govuk-link">
12
+ <a href="<%= GovukPersonalisation::Urls.feedback %>" class="govuk-link">
13
13
  <%= t("components.layout_for_public.account_layout.feedback.banners.footer_link") %>
14
14
  </a>
15
15
  <%= t("components.layout_for_public.account_layout.feedback.banners.footer_outro") %>
@@ -1,7 +1,7 @@
1
1
  <div class="govuk-width-container">
2
2
  <% message = capture do %>
3
3
  <%= t("components.layout_for_public.account_layout.feedback.banners.phase_intro") %>
4
- <a class="govuk-link" href=<%= "#{Plek.find('account-manager')}/feedback" %>>
4
+ <a class="govuk-link" href=<%= GovukPersonalisation::Urls.feedback %>>
5
5
  <%= t("components.layout_for_public.account_layout.feedback.banners.phase_link") %>
6
6
  </a>
7
7
  <%= t("components.layout_for_public.account_layout.feedback.banners.phase_outro") %>
@@ -5,7 +5,7 @@
5
5
  <li class="gem-c-layout-for-public-account-menu__item <%= "gem-c-layout-for-public-account-menu__item--current" if page_is == "your-account" %>">
6
6
  <%= link_to(
7
7
  t("components.layout_for_public.account_layout.navigation.menu_bar.account.link_text"),
8
- "#{Plek.find('account-manager')}",
8
+ GovukPersonalisation::Urls.your_account,
9
9
  class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
10
10
  'aria-current': page_is == "your-account" ? "page" : nil,
11
11
  ) %>
@@ -13,7 +13,7 @@
13
13
  <li class="gem-c-layout-for-public-account-menu__item <%= "gem-c-layout-for-public-account-menu__item--current" if page_is == "manage" %>">
14
14
  <%= link_to(
15
15
  t("components.layout_for_public.account_layout.navigation.menu_bar.manage.link_text"),
16
- "#{Plek.find('account-manager')}/account/manage",
16
+ GovukPersonalisation::Urls.manage,
17
17
  class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
18
18
  'aria-current': page_is == "manage" ? "page" : nil,
19
19
  ) %>
@@ -21,7 +21,7 @@
21
21
  <li class="gem-c-layout-for-public-account-menu__item <%= "gem-c-layout-for-public-account-menu__item--current" if page_is == "security" %>">
22
22
  <%= link_to(
23
23
  t("components.layout_for_public.account_layout.navigation.menu_bar.security.link_text"),
24
- "#{Plek.find('account-manager')}/account/security",
24
+ GovukPersonalisation::Urls.security,
25
25
  class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
26
26
  'aria-current': page_is == "security" ? "page" : nil,
27
27
  ) %>
@@ -46,6 +46,12 @@ en:
46
46
  - We’d like to set additional cookies to understand how you use GOV.UK, remember your settings and improve government services.
47
47
  - We also use cookies set by other sites to help us deliver content from their services.
48
48
  title: Cookies on GOV.UK
49
+ devolved_nations:
50
+ applies_to: Applies to
51
+ england: England
52
+ northern_ireland: Northern Ireland
53
+ scotland: Scotland
54
+ wales: Wales
49
55
  feedback:
50
56
  close: Close
51
57
  dont_include_personal_info: Don’t include personal or financial information like your National Insurance number or credit card details.
@@ -118,7 +124,8 @@ en:
118
124
  - label: Topics
119
125
  href: "/browse"
120
126
  description: Find information and services
121
- menu_contents:
127
+ menu_contents: # If adding or removing items, remember to update the
128
+ # `columns` in the layout-super-navigation-header SCSS.
122
129
  - label: Benefits
123
130
  href: "/browse/benefits"
124
131
  - label: Births, death, marriages and care
@@ -160,7 +167,8 @@ en:
160
167
  - label: Government activity
161
168
  href: "/search/news-and-communications"
162
169
  description: Find out what the government is doing
163
- menu_contents:
170
+ menu_contents: # If adding or removing items, remember to update the
171
+ # `columns` in the layout-super-navigation-header SCSS.
164
172
  - label: News
165
173
  href: "/search/news-and-communications"
166
174
  description: News stories, speeches, letters and notices
@@ -0,0 +1,27 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class DevolvedNationsHelper
4
+ attr_reader :national_applicability
5
+
6
+ def initialize(local_assigns)
7
+ @national_applicability = local_assigns[:national_applicability]
8
+ end
9
+
10
+ def applicable_nations_title_text
11
+ @national_applicability
12
+ .select { |_, v| v[:applicable] == true }
13
+ .map { |k, _| I18n.t("components.devolved_nations.#{k}") }
14
+ .sort
15
+ .to_sentence(last_word_connector: " and ")
16
+ end
17
+
18
+ def nations_with_urls
19
+ @national_applicability
20
+ .select do |_, v|
21
+ v[:alternative_url]
22
+ .present?
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -4,12 +4,12 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :href, :href_data_attributes, :extra_links, :large, :extra_links_no_indent, :heading_text, :metadata, :lang, :image_loading
7
+ attr_reader :href, :href_data_attributes, :extra_details, :large, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading
8
8
 
9
9
  def initialize(local_assigns)
10
10
  @href = local_assigns[:href]
11
11
  @href_data_attributes = local_assigns[:href_data_attributes]
12
- @extra_links = local_assigns[:extra_links] || []
12
+ @extra_details = local_assigns[:extra_details] || []
13
13
  @image_src = local_assigns[:image_src]
14
14
  @image_alt = local_assigns[:image_alt] || ""
15
15
  @image_loading = local_assigns[:image_loading] || "auto"
@@ -17,7 +17,7 @@ module GovukPublishingComponents
17
17
  @description = local_assigns[:description]
18
18
  @large = local_assigns[:large]
19
19
  @heading_text = local_assigns[:heading_text]
20
- @extra_links_no_indent = local_assigns[:extra_links_no_indent]
20
+ @extra_details_no_indent = local_assigns[:extra_details_no_indent]
21
21
  @metadata = local_assigns[:metadata]
22
22
  @lang = local_assigns[:lang]
23
23
  end
@@ -25,8 +25,8 @@ module GovukPublishingComponents
25
25
  def is_tracking?
26
26
  return true if @href_data_attributes
27
27
 
28
- if @extra_links
29
- @extra_links.each do |link|
28
+ if @extra_details
29
+ @extra_details.each do |link|
30
30
  return true if link[:data_attributes]
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "25.6.0".freeze
2
+ VERSION = "27.1.0".freeze
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require "active_support"
2
2
  require "action_controller"
3
3
  require "action_view"
4
+ require "govuk_personalisation"
4
5
  require "govuk_publishing_components/config"
5
6
  require "govuk_publishing_components/engine"
6
7
  require "govuk_publishing_components/presenters/shared_helper"
@@ -10,6 +11,7 @@ require "govuk_publishing_components/presenters/breadcrumb_selector"
10
11
  require "govuk_publishing_components/presenters/brexit_cta_helper"
11
12
  require "govuk_publishing_components/presenters/button_helper"
12
13
  require "govuk_publishing_components/presenters/contextual_navigation"
14
+ require "govuk_publishing_components/presenters/devolved_nations_helper"
13
15
  require "govuk_publishing_components/presenters/related_navigation_helper"
14
16
  require "govuk_publishing_components/presenters/step_by_step_nav_helper"
15
17
  require "govuk_publishing_components/presenters/page_with_step_by_step_navigation"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 25.6.0
4
+ version: 27.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-24 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: govuk_personalisation
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: kramdown
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 5.0.0.1
75
+ version: '6'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 5.0.0.1
82
+ version: '6'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rouge
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -522,6 +536,7 @@ files:
522
536
  - app/assets/stylesheets/govuk_publishing_components/components/_attachment-link.scss
523
537
  - app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss
524
538
  - app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss
539
+ - app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss
525
540
  - app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
526
541
  - app/assets/stylesheets/govuk_publishing_components/components/_button.scss
527
542
  - app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss
@@ -533,6 +548,7 @@ files:
533
548
  - app/assets/stylesheets/govuk_publishing_components/components/_copy-to-clipboard.scss
534
549
  - app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss
535
550
  - app/assets/stylesheets/govuk_publishing_components/components/_details.scss
551
+ - app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss
536
552
  - app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
537
553
  - app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss
538
554
  - app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss
@@ -657,6 +673,7 @@ files:
657
673
  - app/views/govuk_publishing_components/components/_attachment.html.erb
658
674
  - app/views/govuk_publishing_components/components/_attachment_link.html.erb
659
675
  - app/views/govuk_publishing_components/components/_back_link.html.erb
676
+ - app/views/govuk_publishing_components/components/_big_number.html.erb
660
677
  - app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
661
678
  - app/views/govuk_publishing_components/components/_button.html.erb
662
679
  - app/views/govuk_publishing_components/components/_character_count.html.erb
@@ -670,6 +687,7 @@ files:
670
687
  - app/views/govuk_publishing_components/components/_copy_to_clipboard.html.erb
671
688
  - app/views/govuk_publishing_components/components/_date_input.html.erb
672
689
  - app/views/govuk_publishing_components/components/_details.html.erb
690
+ - app/views/govuk_publishing_components/components/_devolved_nations.html.erb
673
691
  - app/views/govuk_publishing_components/components/_document_list.html.erb
674
692
  - app/views/govuk_publishing_components/components/_error_alert.html.erb
675
693
  - app/views/govuk_publishing_components/components/_error_message.html.erb
@@ -738,6 +756,7 @@ files:
738
756
  - app/views/govuk_publishing_components/components/docs/attachment.yml
739
757
  - app/views/govuk_publishing_components/components/docs/attachment_link.yml
740
758
  - app/views/govuk_publishing_components/components/docs/back_link.yml
759
+ - app/views/govuk_publishing_components/components/docs/big_number.yml
741
760
  - app/views/govuk_publishing_components/components/docs/breadcrumbs.yml
742
761
  - app/views/govuk_publishing_components/components/docs/button.yml
743
762
  - app/views/govuk_publishing_components/components/docs/character_count.yml
@@ -751,6 +770,7 @@ files:
751
770
  - app/views/govuk_publishing_components/components/docs/copy_to_clipboard.yml
752
771
  - app/views/govuk_publishing_components/components/docs/date_input.yml
753
772
  - app/views/govuk_publishing_components/components/docs/details.yml
773
+ - app/views/govuk_publishing_components/components/docs/devolved_nations.yml
754
774
  - app/views/govuk_publishing_components/components/docs/document_list.yml
755
775
  - app/views/govuk_publishing_components/components/docs/error_alert.yml
756
776
  - app/views/govuk_publishing_components/components/docs/error_message.yml
@@ -915,6 +935,7 @@ files:
915
935
  - lib/govuk_publishing_components/presenters/contents_list_helper.rb
916
936
  - lib/govuk_publishing_components/presenters/contextual_navigation.rb
917
937
  - lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb
938
+ - lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
918
939
  - lib/govuk_publishing_components/presenters/heading_helper.rb
919
940
  - lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb
920
941
  - lib/govuk_publishing_components/presenters/image_card_helper.rb