govuk_publishing_components 21.8.1 → 21.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ca81043e6252ced61dd220a3f4aa4802d4ecba0ebabf81fed75a1653877add0
4
- data.tar.gz: ed2a9a7de02fb7cc4d25a45eedd6da9db4dc41a28b935c758e8c9e21ec483eba
3
+ metadata.gz: d362c075a89db5f3d1587d72e9a3d0c8070cbe2713a35b778fdb3d545b36e487
4
+ data.tar.gz: 1dc4a84c352fc5b14dcbf4f56d983c6d4393dd2fbbaca7e8bebb32ebe01c4520
5
5
  SHA512:
6
- metadata.gz: cbd778a0d8e9d01c126cc76b52f4657578f876fc781ed07a0787767f0ca630adc334b498b4a99e6c38b34a105f1c1b9c7b3e08a4a9ee3532b70db294c9e4ecea
7
- data.tar.gz: 91de82c142a3afe6d56861bfe00f37edd19a93209006c6a0b52ec3ac1798c0bbfde5009013f77ab6f230791b2174d1e78e2102b4420e107da4501ee7323a379d
6
+ metadata.gz: 3a824a6145852638cedcd298c05e21298a79e23c12773f1e5cf331767ecd23966981d6cfa9e698c6e3f576ddcb22ebc92485fb1328e3eba3f20430a80705172e
7
+ data.tar.gz: 7531c820a83f0132b353e5a35fdba7095f0f1a49f9899cdd26a7c99212da6fcb052e030d03488da7dfc16533a28210ac3f206c38d5c9060be8c37e778371180a
@@ -28,6 +28,7 @@
28
28
  @import "components/chevron-banner";
29
29
  @import "components/contents-list";
30
30
  @import "components/contextual-guidance";
31
+ @import "components/contextual-sidebar";
31
32
  @import "components/cookie-banner";
32
33
  @import "components/copy-to-clipboard";
33
34
  @import "components/date-input";
@@ -0,0 +1,9 @@
1
+ .gem-c-contextual-sidebar__brexit-cta {
2
+ border-top: 2px solid $govuk-brand-colour;
3
+ }
4
+
5
+ .gem-c-contextual-sidebar__brexit-heading {
6
+ @include govuk-font(19, $weight: bold);
7
+ padding-top: govuk-spacing(3);
8
+ margin-bottom: govuk-spacing(2);
9
+ }
@@ -1,6 +1,10 @@
1
1
  <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
2
 
3
3
  <div class="gem-c-contextual-sidebar">
4
+ <% if navigation.show_brexit_cta? && navigation.step_by_step_count.eql?(0) %>
5
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
6
+ <% end %>
7
+
4
8
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
5
9
  <%# Rendering step by step related items because there are a few but not too many of them %>
6
10
  <%= render 'govuk_publishing_components/components/step_by_step_nav_related', links: navigation.step_nav_helper.related_links %>
@@ -17,9 +21,13 @@
17
21
  <% if navigation.content_tagged_to_other_step_by_steps? %>
18
22
  <%# Rendering step by step related items because there are a few but not too many of them %>
19
23
  <%= render 'govuk_publishing_components/components/step_by_step_nav_related', {
20
- pretitle: "Also part of",
24
+ pretitle: "Also part of",
21
25
  links: navigation.step_nav_helper.also_part_of_step_nav,
22
26
  always_display_as_list: true
23
27
  } %>
24
28
  <% end %>
29
+
30
+ <% if navigation.show_brexit_cta? && navigation.step_by_step_count > 0 %>
31
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
32
+ <% end %>
25
33
  </div>
@@ -41,7 +41,7 @@
41
41
  class: "govuk-link",
42
42
  title: "Change #{item[:field]}",
43
43
  data: item[:edit].fetch(:data_attributes, {}) do %>
44
- Change<%= tag.span " " + item[:field], class: "govuk-visually-hidden" %><% end %>
44
+ Change<%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" %><% end %>
45
45
  <% end %>
46
46
  <% end %>
47
47
  <% if item.fetch(:delete, {}).any? %>
@@ -50,7 +50,7 @@
50
50
  class: "govuk-link",
51
51
  title: "Delete #{item[:field]}",
52
52
  data: item[:delete].fetch(:data_attributes, {}) do %>
53
- Delete<%= tag.span " " + item[:field], class: "govuk-visually-hidden" %>
53
+ Delete<%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" %>
54
54
  <% end %>
55
55
  <% end %>
56
56
  <% end %>
@@ -0,0 +1,4 @@
1
+ <div class="gem-c-contextual-sidebar__brexit-cta govuk-!-margin-bottom-6" data-module="track-click">
2
+ <h2 class="gem-c-contextual-sidebar__brexit-heading">Brexit</h2>
3
+ <a href="/brexit" class="govuk-link" data-track-category="relatedLinkClicked" data-track-action="1.0 Brexit" data-track-label="/brexit" data-track-options='{"dimension29":"Check what you need to do"}'>Check what you need to do</a>
4
+ </div>
@@ -38,7 +38,7 @@ examples:
38
38
  - title: The future of jobs and skills
39
39
  base_path: /government/collections/the-future-of-jobs-and-skills
40
40
  document_type: document_collection
41
- with_step_by_step:
41
+ with_part_of_step_by_step:
42
42
  data:
43
43
  content_item:
44
44
  title: "A content item"
@@ -51,3 +51,99 @@ examples:
51
51
  ordered_related_items:
52
52
  - title: "Find an apprenticeship"
53
53
  base_path: "/apply-apprenticeship"
54
+ with_current_step_by_step:
55
+ data:
56
+ content_item:
57
+ title: "A content item"
58
+ links:
59
+ part_of_step_navs:
60
+ - title: "Choosing a micropig or micropug: step by step"
61
+ base_path: "/micropigs-vs-micropugs"
62
+ details:
63
+ step_by_step_nav:
64
+ title: 'Stay in the UK after it leaves the EU (''settled status''): step by step'
65
+ steps:
66
+ - title: Check if you need to apply to the EU Settlement Scheme
67
+ contents:
68
+ - type: paragraph
69
+ text: 'You may need to apply to the EU Settlement Scheme to continue living
70
+ in the UK. '
71
+ - type: list
72
+ contents:
73
+ - text: Check if you need to apply
74
+ href: "/settled-status-eu-citizens-families/eligibility"
75
+ optional: false
76
+ - title: Find out what status you’ll get
77
+ contents:
78
+ - type: paragraph
79
+ text: You’ll get settled or pre-settled status depending on how long you’ve
80
+ been living in the UK. This might affect when you choose to apply.
81
+ - type: list
82
+ contents:
83
+ - text: Find out what you’ll get
84
+ href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
85
+ optional: false
86
+ with_brexit_cta_and_related_links:
87
+ data:
88
+ content_item:
89
+ title: "A content item"
90
+ links:
91
+ taxons:
92
+ - content_id: "test"
93
+ title: "Not Brexit"
94
+ phase: "live"
95
+ links:
96
+ parent_taxons:
97
+ - content_id: "d6c2de5d-ef90-45d1-82d4-5f2438369eea"
98
+ title: "Brexit"
99
+ ordered_related_items:
100
+ - title: Find an apprenticeship
101
+ base_path: /apply-apprenticeship
102
+ - title: Training and study at work
103
+ base_path: /training-study-work-your-rights
104
+ - title: Careers helpline for teenagers
105
+ base_path: /careers-helpline-for-teenagers
106
+ document_collections:
107
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
108
+ base_path: /government/collections/apprenticeship-vacancies
109
+ document_type: document_collection
110
+ - title: The future of jobs and skills
111
+ base_path: /government/collections/the-future-of-jobs-and-skills
112
+ document_type: document_collection
113
+ with_brexit_cta_and_step_by_steps:
114
+ data:
115
+ content_item:
116
+ title: "A content item"
117
+ links:
118
+ taxons:
119
+ - content_id: "d6c2de5d-ef90-45d1-82d4-5f2438369eea"
120
+ title: "Brexit"
121
+ phase: "live"
122
+ part_of_step_navs:
123
+ - title: "Choosing a micropig or micropug: step by step"
124
+ base_path: "/micropigs-vs-micropugs"
125
+ details:
126
+ step_by_step_nav:
127
+ title: 'Stay in the UK after it leaves the EU (''settled status''): step by step'
128
+ steps:
129
+ - title: Check if you need to apply to the EU Settlement Scheme
130
+ contents:
131
+ - type: paragraph
132
+ text: 'You may need to apply to the EU Settlement Scheme to continue living
133
+ in the UK. '
134
+ - type: list
135
+ contents:
136
+ - text: Check if you need to apply
137
+ href: "/settled-status-eu-citizens-families/eligibility"
138
+ optional: false
139
+ - title: Find out what status you’ll get
140
+ contents:
141
+ - type: paragraph
142
+ text: You’ll get settled or pre-settled status depending on how long you’ve
143
+ been living in the UK. This might affect when you choose to apply.
144
+ - type: list
145
+ contents:
146
+ - text: Find out what you’ll get
147
+ href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
148
+ optional: false
149
+
@@ -60,6 +60,32 @@ module GovukPublishingComponents
60
60
  content_item["schema_name"] == "specialist_document"
61
61
  end
62
62
 
63
+ def tagged_to_brexit?
64
+ taxons = content_item.dig("links", "taxons").to_a
65
+ brexit_taxon = "d6c2de5d-ef90-45d1-82d4-5f2438369eea"
66
+ world_brexit_taxon = "d4c4d91d-fbe7-4eff-bd57-189138c626c9"
67
+
68
+ taxons.each do |taxon|
69
+ if taxon["content_id"].eql?(brexit_taxon) ||
70
+ taxon["content_id"].eql?(world_brexit_taxon) ||
71
+ taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_item["content_id"].eql?(brexit_taxon) }
72
+ return true
73
+ end
74
+ end
75
+
76
+ false
77
+ end
78
+
79
+ def show_brexit_cta?
80
+ # If tagged directly to /brexit or /world/brexit
81
+ # Or if tagged to a taxon which has /brexit as a parent
82
+ tagged_to_brexit?
83
+ end
84
+
85
+ def step_by_step_count
86
+ step_nav_helper.step_navs.count
87
+ end
88
+
63
89
  def content_tagged_to_current_step_by_step?
64
90
  # TODO: remove indirection here
65
91
  step_nav_helper.show_header?
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '21.8.1'.freeze
2
+ VERSION = '21.9.0'.freeze
3
3
  end
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: 21.8.1
4
+ version: 21.9.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: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters
@@ -438,6 +438,7 @@ files:
438
438
  - app/assets/stylesheets/govuk_publishing_components/components/_chevron-banner.scss
439
439
  - app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss
440
440
  - app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss
441
+ - app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss
441
442
  - app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss
442
443
  - app/assets/stylesheets/govuk_publishing_components/components/_copy-to-clipboard.scss
443
444
  - app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss
@@ -631,6 +632,7 @@ files:
631
632
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
632
633
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.svg
633
634
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.svg
635
+ - app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
634
636
  - app/views/govuk_publishing_components/components/docs/accordion.yml
635
637
  - app/views/govuk_publishing_components/components/docs/admin_analytics.yml
636
638
  - app/views/govuk_publishing_components/components/docs/attachment.yml