govuk_publishing_components 26.0.0 → 27.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c3fd9e474526fc795f4e36972c920118b87ea55a36296a4b5ed63e5e6fdc116
4
- data.tar.gz: 84373dc03aa19d36852a9d7766924a42c2a1e97704f23f0829b1723d1bf46e33
3
+ metadata.gz: 57832f873fbcb6c9c245858ca1626b8fe4548ee312a96597e0e2ef06ce776ddd
4
+ data.tar.gz: ca662dd2ac3a84e232942628613a5e2f36aeab7a5b6b21f4227d727d514ab0ed
5
5
  SHA512:
6
- metadata.gz: e997a780198073f264b340747df742bf7b9540e2f8106f9f29afb16028ea95533a22d4bf1403aa2b027785a9298585ac7700865ede41d7ab42dd1c00c6fcee70
7
- data.tar.gz: 1d38aaaff509242556aebea94b66fe42001345f93f15513ee42c27f1f71d105e8a2f49e7b2e110f1ca317f5ffbf769e4cc4bc3fb00113a9ca88a00eb1fb28cad
6
+ metadata.gz: 73096c4cec16fc95e026911ae54503935ca718b7f0935892412c299f1ed1f5ae7b78db6e555c0256a326126db75673a4027a62840d584bdf185c67bf3c13fda9
7
+ data.tar.gz: b482b8fa029539c6c7bc1f196165f75c1d48d8891188cd2fff978b7fdee96cff9a8c74b74736acaa1092caba2a1469b0bbb05743e7dbce567eff433f42fddc60
@@ -27,6 +27,7 @@ $govuk-new-link-styles: true;
27
27
  @import "components/copy-to-clipboard";
28
28
  @import "components/date-input";
29
29
  @import "components/details";
30
+ @import "components/devolved-nations";
30
31
  @import "components/document-list";
31
32
  @import "components/error-alert";
32
33
  @import "components/error-message";
@@ -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);
@@ -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
 
@@ -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,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,9 +44,9 @@
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| %>
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
50
  <li class="gem-c-image-card__list-item <%= "gem-c-image-card__list-item--text" if not link[:href].present? %>">
51
51
  <% if link[:href].present? %>
52
52
  <%= link_to link[:text], link[:href],
@@ -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,21 +96,21 @@ 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_links:
107
- description: If `extra_links` are passed to the component without `href` attributes, they are displayed as a simple text list.
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
108
  data:
109
109
  href: "/government/people/"
110
110
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
111
111
  image_alt: "some meaningful alt text please"
112
112
  heading_text: "John Whiskers MP"
113
- extra_links: [
113
+ extra_details: [
114
114
  {
115
115
  text: "Conservative 2010 to 2016",
116
116
  },
@@ -118,14 +118,14 @@ examples:
118
118
  text: "Labour 2007 to 2010",
119
119
  }
120
120
  ]
121
- extra_links_no_indent: true
122
- extra_links_with_no_main_link:
121
+ extra_details_no_indent: true
122
+ extra_details_with_no_main_link:
123
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.
124
124
  data:
125
125
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
126
126
  image_alt: "some meaningful alt text please"
127
127
  heading_text: "John Whiskers MP"
128
- extra_links: [
128
+ extra_details: [
129
129
  {
130
130
  text: "Minister for Cats",
131
131
  href: "/government/ministers/"
@@ -145,7 +145,7 @@ examples:
145
145
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
146
146
  image_alt: "some meaningful alt text please"
147
147
  description: Here are some links to more information about the thing you are reading about.
148
- extra_links: [
148
+ extra_details: [
149
149
  {
150
150
  text: "More information",
151
151
  href: "/1"
@@ -174,7 +174,7 @@ examples:
174
174
  image_alt: "some meaningful alt text please"
175
175
  heading_text: "Something relating to this"
176
176
  description: "Public reform committee consultation vote department interior minister referendum."
177
- extra_links: [
177
+ extra_details: [
178
178
  {
179
179
  text: "Something",
180
180
  href: "/1"
@@ -210,7 +210,7 @@ examples:
210
210
  image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
211
211
  image_alt: "some meaningful alt text please"
212
212
  heading_text: "A link with tracking"
213
- extra_links: [
213
+ extra_details: [
214
214
  {
215
215
  text: "Another link with tracking",
216
216
  href: "/1",
@@ -235,13 +235,13 @@ examples:
235
235
  text: "The Rt Hon"
236
236
  heading_text: "John Whiskers MP"
237
237
  metadata: "Unpaid"
238
- extra_links: [
238
+ extra_details: [
239
239
  {
240
240
  text: "Minister for Cats",
241
241
  href: "/government/ministers/"
242
242
  }
243
243
  ]
244
- extra_links_no_indent: true
244
+ extra_details_no_indent: true
245
245
  with_lang:
246
246
  description: |
247
247
  Pass through an appropriate `lang` to set a HTML lang attribute for the component.
@@ -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.
@@ -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 = "26.0.0".freeze
2
+ VERSION = "27.0.0".freeze
3
3
  end
@@ -11,6 +11,7 @@ require "govuk_publishing_components/presenters/breadcrumb_selector"
11
11
  require "govuk_publishing_components/presenters/brexit_cta_helper"
12
12
  require "govuk_publishing_components/presenters/button_helper"
13
13
  require "govuk_publishing_components/presenters/contextual_navigation"
14
+ require "govuk_publishing_components/presenters/devolved_nations_helper"
14
15
  require "govuk_publishing_components/presenters/related_navigation_helper"
15
16
  require "govuk_publishing_components/presenters/step_by_step_nav_helper"
16
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: 26.0.0
4
+ version: 27.0.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-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -547,6 +547,7 @@ files:
547
547
  - app/assets/stylesheets/govuk_publishing_components/components/_copy-to-clipboard.scss
548
548
  - app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss
549
549
  - app/assets/stylesheets/govuk_publishing_components/components/_details.scss
550
+ - app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss
550
551
  - app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
551
552
  - app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss
552
553
  - app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss
@@ -684,6 +685,7 @@ files:
684
685
  - app/views/govuk_publishing_components/components/_copy_to_clipboard.html.erb
685
686
  - app/views/govuk_publishing_components/components/_date_input.html.erb
686
687
  - app/views/govuk_publishing_components/components/_details.html.erb
688
+ - app/views/govuk_publishing_components/components/_devolved_nations.html.erb
687
689
  - app/views/govuk_publishing_components/components/_document_list.html.erb
688
690
  - app/views/govuk_publishing_components/components/_error_alert.html.erb
689
691
  - app/views/govuk_publishing_components/components/_error_message.html.erb
@@ -765,6 +767,7 @@ files:
765
767
  - app/views/govuk_publishing_components/components/docs/copy_to_clipboard.yml
766
768
  - app/views/govuk_publishing_components/components/docs/date_input.yml
767
769
  - app/views/govuk_publishing_components/components/docs/details.yml
770
+ - app/views/govuk_publishing_components/components/docs/devolved_nations.yml
768
771
  - app/views/govuk_publishing_components/components/docs/document_list.yml
769
772
  - app/views/govuk_publishing_components/components/docs/error_alert.yml
770
773
  - app/views/govuk_publishing_components/components/docs/error_message.yml
@@ -929,6 +932,7 @@ files:
929
932
  - lib/govuk_publishing_components/presenters/contents_list_helper.rb
930
933
  - lib/govuk_publishing_components/presenters/contextual_navigation.rb
931
934
  - lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb
935
+ - lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
932
936
  - lib/govuk_publishing_components/presenters/heading_helper.rb
933
937
  - lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb
934
938
  - lib/govuk_publishing_components/presenters/image_card_helper.rb