govuk_publishing_components 21.23.1 → 21.24.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: 528cf797ecd8f1a2d4603964f6c30cab2363d8766f9aea9788a1d7291babb91a
4
- data.tar.gz: 6c1677759f22c12e8fd9627d3a29e36a06b3905295c38d6b86c90a0bf89e2db1
3
+ metadata.gz: 852f3e158e84b94b02db8e065964955db1e252c11fb8e90db04284e56a998a12
4
+ data.tar.gz: 187b7946e006dd1b84b0e949736d32f286be107d2ee182766abbac45a75fc623
5
5
  SHA512:
6
- metadata.gz: 51bb0f8fd36671cb908211d47b80763123d9394858086802f18291c63891c831389e87ffc7661ce929c9f2bc3376ca146eb0ac375271abeea45d83833ac3727b
7
- data.tar.gz: ac3d69fcaee7f858de8558816a4090384e693135d505c6016d375b37729a68a5df62593ef28dc1e19adf48b8a285d41fa89af505b32a405f36d023a14795595c
6
+ metadata.gz: f83735ddd15083e567d8ff030fc0bf9fe933b929fa265bc7c76637a880000d4f1ac24a5c724728e64be55f5cca61debc9134bc132bb2a2542ec375e533c71170
7
+ data.tar.gz: 8e1af044ebd75237948275b713ba1276e54b09a1303adc8f6ac48f88414e50b2ed59a8d9ff77825f21d06a0b1a0d5ce641d46cc18b249c6c704ac8a86f5e9c27
@@ -1 +1,38 @@
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
+ }
29
+ }
30
+
31
+ .govuk-back-link::after {
32
+ content: "";
33
+ position: absolute;
34
+ top: -14px;
35
+ right: 0;
36
+ left: 0;
37
+ bottom: -14px;
38
+ }
@@ -2,7 +2,7 @@
2
2
  breadcrumbs ||= []
3
3
  inverse ||= false
4
4
  invert_class = inverse ? "gem-c-breadcrumbs--inverse" : ""
5
- breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs, request.path)
5
+ breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)
6
6
  %>
7
7
 
8
8
  <script type="application/ld+json">
@@ -4,6 +4,7 @@
4
4
 
5
5
  label ||= nil
6
6
  heading ||= nil
7
+ heading_caption ||= nil
7
8
  small ||= false
8
9
  inline ||= false
9
10
  is_page_heading ||= false
@@ -39,6 +40,7 @@
39
40
  <% if heading.present? %>
40
41
  <% if is_page_heading %>
41
42
  <%= tag.legend class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title" do %>
43
+ <%= tag.span(heading_caption, class: "govuk-caption-xl") if heading_caption.present? %>
42
44
  <%= tag.h1 heading, class: "gem-c-title__text" %>
43
45
  <% end %>
44
46
  <% else %>
@@ -6,7 +6,7 @@
6
6
  { title: "Home", url: "/" },
7
7
  { title: title, url: path }
8
8
  ]
9
- breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs, request.path)
9
+ breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)
10
10
  %>
11
11
  <% if title %>
12
12
  <script type="application/ld+json">
@@ -3,6 +3,8 @@ description: "Navigational breadcrumbs, showing page hierarchy"
3
3
  body: |
4
4
  Accepts an array of breadcrumb objects. Each crumb must have a title and a URL.
5
5
  Links have tracking data but links to the homepage (any link with a url of "/") will be tracked separately as `homeLinkClicked`
6
+
7
+ Note: Only the first and last (or parent) item in the breadcrumb will be displayed when the page width is less than the "tablet" govuk-breakpoint.
6
8
  shared_accessibility_criteria:
7
9
  - link
8
10
  accessibility_criteria:
@@ -28,7 +30,6 @@ examples:
28
30
  - title: 'Sub-section'
29
31
  url: '/section/sub-section'
30
32
  title: 'Education of disadvantaged children'
31
- is_current_page: true
32
33
  inverse: true
33
34
  context:
34
35
  dark_background: true
@@ -67,26 +68,8 @@ examples:
67
68
  url: '/browse/abroad'
68
69
  - title: 'Travel abroad'
69
70
  url: '/browse/abroad/travel-abroad'
70
- last_breadcrumb_is_current_page:
71
- data:
72
- breadcrumbs:
73
- - title: 'Home'
74
- url: '/'
75
- - title: 'Passports, travel and living abroad'
76
- url: '/browse/abroad'
77
- - title: 'Travel abroad'
78
- highlight_current_page:
79
- description: This is currently used on pages tagged to the taxonomy, such as [on this page](https://www.gov.uk/guidance/pupil-premium-information-for-schools-and-alternative-provision-settings).
80
- data:
81
- breadcrumbs:
82
- - title: 'Home'
83
- url: '/'
84
- - title: 'Education, training and skills'
85
- url: '/education'
86
- - title: 'Education of disadvantaged children'
87
- is_current_page: true
88
- collapse_on_mobile:
89
- description: This is currently used within on pages tagged to the taxonomy, such as [on this page](https://www.gov.uk/guidance/pupil-premium-information-for-schools-and-alternative-provision-settings).
71
+ long_taxon_on_mobile:
72
+ description: This is an example of a breadcrumb (specifically for mobile) with long taxons on the the parent item and a greater touch target area
90
73
  data:
91
74
  collapse_on_mobile: true
92
75
  breadcrumbs:
@@ -94,5 +77,5 @@ examples:
94
77
  url: '/'
95
78
  - title: 'Education, training and skills'
96
79
  url: '/education'
97
- is_page_parent: true
98
- - title: 'Education of disadvantaged children'
80
+ - title: 'Education of disadvantaged children appended with some extra long content to make this a very very very very long taxon'
81
+ url: '/education'
@@ -106,6 +106,23 @@ examples:
106
106
  value: "green"
107
107
  - label: "Blue"
108
108
  value: "blue"
109
+ with_page_header_and_caption:
110
+ description: |
111
+ If a caption text is provided with a page heading, it will be displayed above the heading.
112
+ A caption can only be used with a page heading. If a heading is not provided the caption will not render.
113
+ The pattern is used across GOV.UK to show a high-level section that this page question falls into.
114
+ data:
115
+ name: "favourite_skittle"
116
+ heading: "Choose your favourite skittles"
117
+ heading_caption: "Question 3 of 9"
118
+ is_page_heading: true
119
+ items:
120
+ - label: "Red"
121
+ value: "red"
122
+ - label: "Green"
123
+ value: "green"
124
+ - label: "Blue"
125
+ value: "blue"
109
126
  without_hint_text:
110
127
  description: Hint text can be removed entirely with this option. Note that this option can be combined with the visually_hide_heading option.
111
128
  data:
@@ -108,6 +108,21 @@ examples:
108
108
  text: "Yes"
109
109
  - value: "no"
110
110
  text: "No"
111
+ with_page_header_and_caption:
112
+ description: |
113
+ If a caption text is provided with a page heading, it will be displayed above the heading.
114
+ A caption can only be used with a page heading. If a heading is not provided the caption will not render.
115
+ The pattern is used across GOV.UK to show a high-level section that this page question falls into.
116
+ data:
117
+ name: "radio-group-heading"
118
+ heading: "Is it snowing?"
119
+ heading_caption: "Question 3 of 9"
120
+ is_page_heading: true
121
+ items:
122
+ - value: "yes"
123
+ text: "Yes"
124
+ - value: "no"
125
+ text: "No"
111
126
  with_page_heading_and_hint:
112
127
  data:
113
128
  name: "radio-group-heading"
@@ -179,7 +194,6 @@ examples:
179
194
  text: "Green"
180
195
  - value: "blue"
181
196
  text: "Blue"
182
-
183
197
  with_hint_text_on_radios:
184
198
  data:
185
199
  name: "radio-group-hint-text"
@@ -1,9 +1,8 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class Breadcrumbs
4
- def initialize(breadcrumbs, request_path)
4
+ def initialize(breadcrumbs)
5
5
  @breadcrumbs = breadcrumbs
6
- @request_path = request_path
7
6
  end
8
7
 
9
8
  def structured_data
@@ -16,12 +15,12 @@ module GovukPublishingComponents
16
15
 
17
16
  private
18
17
 
19
- attr_reader :breadcrumbs, :request_path
18
+ attr_reader :breadcrumbs
20
19
 
21
20
  def item_list_element
22
21
  breadcrumbs.each_with_index.map { |crumb, index| Breadcrumb.new(crumb, index) }.
23
22
  select(&:is_link?).
24
- map { |breadcrumb| breadcrumb.item_list_element(@request_path) }
23
+ map(&:item_list_element)
25
24
  end
26
25
  end
27
26
 
@@ -34,24 +33,24 @@ module GovukPublishingComponents
34
33
  @index = index + 1
35
34
  end
36
35
 
37
- def item_list_element(request_path)
36
+ def item_list_element
38
37
  {
39
38
  "@type" => "ListItem",
40
39
  "position" => index,
41
- "item" => list_item_item(request_path)
40
+ "item" => list_item_item
42
41
  }
43
42
  end
44
43
 
45
44
  def is_link?
46
- crumb[:url].present? || crumb[:is_current_page]
45
+ crumb[:url].present?
47
46
  end
48
47
 
49
48
  def path
50
- crumb[:is_current_page] ? '#content' : crumb[:url]
49
+ crumb[:url]
51
50
  end
52
51
 
53
52
  def aria_current
54
- crumb[:is_current_page] ? 'page' : 'false'
53
+ 'false'
55
54
  end
56
55
 
57
56
  def tracking_data(breadcrumbs_length)
@@ -81,8 +80,8 @@ module GovukPublishingComponents
81
80
 
82
81
  attr_reader :crumb, :index
83
82
 
84
- def list_item_item(request_path)
85
- path = crumb[:is_current_page] ? request_path : crumb[:url]
83
+ def list_item_item
84
+ path = crumb[:url]
86
85
  item = { "name" => crumb[:title] }
87
86
  item["@id"] = Plek.new.website_root + path if path
88
87
  item
@@ -4,7 +4,8 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :items, :name, :css_classes, :list_classes, :error, :has_conditional, :has_nested, :id, :hint_text, :description, :heading_size
7
+ attr_reader :items, :name, :css_classes, :list_classes, :error, :has_conditional,
8
+ :has_nested, :id, :hint_text, :description, :heading_size, :heading_caption
8
9
 
9
10
  def initialize(options)
10
11
  @items = options[:items] || []
@@ -24,6 +25,7 @@ module GovukPublishingComponents
24
25
  @heading = options[:heading] || nil
25
26
  @heading_size = options[:heading_size]
26
27
  @heading_size = 'm' unless %w(s m l xl).include?(@heading_size)
28
+ @heading_caption = options[:heading_caption] || nil
27
29
  @is_page_heading = options[:is_page_heading]
28
30
  @description = options[:description] || nil
29
31
  @no_hint_text = options[:no_hint_text]
@@ -54,7 +56,8 @@ module GovukPublishingComponents
54
56
  :legend,
55
57
  class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title"
56
58
  ) do
57
- content_tag(:h1, @heading, class: "gem-c-title__text")
59
+ concat content_tag(:span, heading_caption, class: "govuk-caption-xl") if heading_caption.present?
60
+ concat content_tag(:h1, @heading, class: "gem-c-title__text")
58
61
  end
59
62
  else
60
63
  classes = %w(govuk-fieldset__legend)
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '21.23.1'.freeze
2
+ VERSION = '21.24.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.23.1
4
+ version: 21.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev