govuk_publishing_components 20.2.2 → 20.3.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: 4455729813d3ce26f113a62404cfbf04ab7dfafb0e4f60676f62284568444a20
4
- data.tar.gz: fabc3adf303439e216df37e559c122f8f2d244669e7ded8047ae7f9b56ee6a5d
3
+ metadata.gz: 1f5df7e2c205738cd3d8cd009d6ca2d05c8dd239010e7069f13bcf30abbcd19e
4
+ data.tar.gz: 06fd2c808c46a8964422df92e7f5c7e7ed17e1e53edd7c64eb5278e420a3220f
5
5
  SHA512:
6
- metadata.gz: 276ed7422a95aa20aa5b05d3e1d0002bc08699f3699110da4977a4a1e58ae74512a42bd3aca9614672fb7e8a673b07387f0cbb84fd1a716105223ef6209ea18b
7
- data.tar.gz: 3dfedf262d21654bdeb51ef572b619abb514778fba8bc5479d5149a5b08f3f9e166f3c741f938f7f31c7639fbbbd9aaf195401f3262462b70f9dda6d8a42eb98
6
+ metadata.gz: 94dc4d5b1b0dbb6fa1623bf86dc9f261b858837e29ec495bc1d99645409248d0b89777c6450d97ee11f44186fcf2bc1e885fe90bb9ac77d7b2fd2de1db82c3e0
7
+ data.tar.gz: 27cf0edb974d92114e4fdfa96cbc0d41ba098794800e4fcdbf6e8f76db0811aaf3898f9aa334deda3244e35c2f6ac1ef51834301cba64a858a57db39b17d6555
@@ -1,5 +1,7 @@
1
1
  <%
2
2
  brand ||= false
3
+ lang = local_assigns[:lang].presence
4
+
3
5
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
4
6
  heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
5
7
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
@@ -12,5 +14,6 @@
12
14
  %>
13
15
  <%= content_tag(shared_helper.get_heading_level, text,
14
16
  class: classes,
15
- id: heading_helper.id
17
+ id: heading_helper.id,
18
+ lang: lang
16
19
  ) %>
@@ -68,3 +68,11 @@ examples:
68
68
  brand: 'department-for-environment-food-rural-affairs'
69
69
  padding: true
70
70
  border_top: 5
71
+ with_lang_attribute:
72
+ description: |
73
+ The component is used on translated pages that don’t have a translation for the text strings. This means that it could display the fallback English string if the translate method can’t find an appropriate translation. This makes sure that the lang can be set to ensure that browsers understand which parts of the page are in each language.
74
+
75
+ The lang attribute must be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is en or eng, Korean is ko or kor - but if in doubt please check.
76
+ data:
77
+ text: "Ein gweinidogion"
78
+ lang: "cy"
@@ -42,11 +42,15 @@ module GovukPublishingComponents
42
42
 
43
43
  def part_url(part, index)
44
44
  if index.zero?
45
- page.canonical_url
45
+ guide_url
46
46
  else
47
- page.canonical_url + "/" + part["slug"]
47
+ guide_url + "/" + part["slug"]
48
48
  end
49
49
  end
50
+
51
+ def guide_url
52
+ Plek.new.website_root + page.base_path
53
+ end
50
54
  end
51
55
  end
52
56
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '20.2.2'.freeze
2
+ VERSION = '20.3.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: 20.2.2
4
+ version: 20.3.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-09-06 00:00:00.000000000 Z
11
+ date: 2019-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters