content_block_tools 0.15.0 → 0.17.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: a7fb206c79f70f74406c8a60d9a9700edc36dd3d1b770aa20bec8f66882e9ace
4
- data.tar.gz: 57ea041ddeedc73c7cd4ee6f0dc14ab6f9936e6c0c37f04cd871f3272160f199
3
+ metadata.gz: b4c641c9036c389a69525715b7e71149166f7511ab1de92f4c15ad95b16d62dd
4
+ data.tar.gz: a607de42bbe8f3b0fe1906d46743e1f73486ea792b1a2cb1374084afa398f4f5
5
5
  SHA512:
6
- metadata.gz: 47025bb1c515acfe6c6a13efbeea0c7112982312d238f2ca1d2de085920c36204acfffcde065cf34d3081b61a80bdf4f514ca962b610c704cc3b7369441073a6
7
- data.tar.gz: cc3b70d529ed13abc838f84fc3b8fa7a88a52efc9f3bc9472b591002e0c59bd495da56ba7f7a524faa52c2d899d7366c09a19bdf8f6bf000584b413897c2f590
6
+ metadata.gz: d711299258a6a6156ba85240bc67143989ace9485999bc41f6e45510294a61418622bfa329eaf6f8b2f693b2a816008cdffaf53e899660e8ba63d8fc8f043bee
7
+ data.tar.gz: a83c41c21a95b2f35c67a2be4ceead0ff6c1fe5d11e3993fa902456063667c519b9750f45175a0306627980581a9d55bda1b24a8b27a0b6bb8b04bb80bd0234c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@
7
7
  useful summary for people upgrading their application, not a replication
8
8
  of the commit log.
9
9
 
10
+ ## 0.17.0
11
+
12
+ - Use recipient field in address ([75](https://github.com/alphagov/govuk_content_block_tools/pull/75))
13
+
14
+ ## 0.16.0
15
+
16
+ - Use label as link text for contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
17
+ - Add description to contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
18
+ - Use label as link text for contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
19
+
10
20
  ## 0.15.0
11
21
 
12
22
  - Rename content block classes ([72](https://github.com/alphagov/govuk_content_block_tools/pull/72))
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "rubocop-govuk", "5.1.18"
32
32
 
33
33
  spec.add_dependency "actionview", ">= 6"
34
- spec.add_dependency "govspeak", "10.6.0"
34
+ spec.add_dependency "govspeak", "10.6.1"
35
35
  end
@@ -12,7 +12,7 @@ module ContentBlockTools
12
12
  output = []
13
13
 
14
14
  output << content_tag(:p, class: "adr") do
15
- %i[title street_address town_or_city state_or_county postal_code country].map { |field|
15
+ %i[recipient street_address town_or_city state_or_county postal_code country].map { |field|
16
16
  next if item[field].blank?
17
17
 
18
18
  content_tag(:span, item[field], { class: class_for_field_name(field) })
@@ -27,6 +27,7 @@ module ContentBlockTools
27
27
 
28
28
  def class_for_field_name(field_name)
29
29
  {
30
+ recipient: "organization-name",
30
31
  street_address: "street-address",
31
32
  town_or_city: "locality",
32
33
  state_or_county: "region",
@@ -10,16 +10,28 @@ module ContentBlockTools
10
10
  def render
11
11
  wrapper do
12
12
  content_tag(:div, class: "email-url-number") do
13
- content_tag(:p) do
14
- concat content_tag(:span, item[:title])
15
- concat content_tag(:a,
16
- item[:url],
17
- class: "url",
18
- href: item[:url])
19
- end
13
+ concat link
14
+ concat description if item[:description]
20
15
  end
21
16
  end
22
17
  end
18
+
19
+ def link
20
+ content_tag(:p) do
21
+ content_tag(:a,
22
+ link_text,
23
+ class: "url",
24
+ href: item[:url])
25
+ end
26
+ end
27
+
28
+ def link_text
29
+ item[:label] || item[:url]
30
+ end
31
+
32
+ def description
33
+ render_govspeak(item[:description])
34
+ end
23
35
  end
24
36
  end
25
37
  end
@@ -18,9 +18,8 @@ module ContentBlockTools
18
18
 
19
19
  def email
20
20
  content_tag(:p) do
21
- concat content_tag(:span, item[:title])
22
21
  concat content_tag(:a,
23
- item[:email_address],
22
+ link_text,
24
23
  class: "email",
25
24
  href: "mailto:#{item[:email_address]}#{query_params}")
26
25
  end
@@ -34,6 +33,10 @@ module ContentBlockTools
34
33
 
35
34
  "?#{params}" if params.present?
36
35
  end
36
+
37
+ def link_text
38
+ item[:label] || item[:email_address]
39
+ end
37
40
  end
38
41
  end
39
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContentBlockTools
4
- VERSION = "0.15.0"
4
+ VERSION = "0.17.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: content_block_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -85,14 +85,14 @@ dependencies:
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 10.6.0
88
+ version: 10.6.1
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 10.6.0
95
+ version: 10.6.1
96
96
  email:
97
97
  - govuk-dev@digital.cabinet-office.gov.uk
98
98
  executables: []