content_block_tools 0.14.0 → 0.16.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: 7c35f73a3b07fb8b012edb15983ee33d887d6210983da08260ef5aa4ee179602
4
- data.tar.gz: 7957496b23bb4abf3631ed7119bf389c62f545d03e16caf805072c485baf0e7b
3
+ metadata.gz: dc5c252953a643976df3b67edfeb89574770b18f19c83e8c89fe97117b9a12d3
4
+ data.tar.gz: 9621e75ef84f2e2ecfed5dc8e2452de47e157e1fa7ffc5448c133957733977a3
5
5
  SHA512:
6
- metadata.gz: 9eb65abd8380bcf954c049343336d5ad9aa964c19fec7587c4769fe741e82777f7127a99540c1cf884a889ff4d72a68ecc52a4f8e4510c93a13f9a728f6ad6bf
7
- data.tar.gz: 79fa8d0a4b48ef725ebade643c9556422b0dac61874aed1ce9323fbf258f8622c0cdcd40874876f0ceb3f6447976b2bac3319ed97e5f2e1d6d757b8d1036a9bb
6
+ metadata.gz: f2e7e1129b8c885327926d605a8bfc0aa9556cf037b3c91ee4a4c36436cd7751646b31c5ecf65301c18520bb65efc45fdbb427e2d6d946f28d0cc63e090048be
7
+ data.tar.gz: c9b5aa1eae520f16eab7dd0143de7af184c7e9c07865af3054caab14cbfea1d22eaab8a85ef06bafd6363286a5b8dcbc3bdbef99a902927032ae5288d65a835d
data/CHANGELOG.md CHANGED
@@ -7,9 +7,19 @@
7
7
  useful summary for people upgrading their application, not a replication
8
8
  of the commit log.
9
9
 
10
+ ## 0.16.0
11
+
12
+ - Use label as link text for contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
13
+ - Add description to contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
14
+ - Use label as link text for contact link ([74](https://github.com/alphagov/govuk_content_block_tools/pull/74))
15
+
16
+ ## 0.15.0
17
+
18
+ - Rename content block classes ([72](https://github.com/alphagov/govuk_content_block_tools/pull/72))
19
+
10
20
  ## 0.14.0
11
21
 
12
- - Update telephone to support simple opening hours ([71](https://github.com/alphagov/govuk_content_block_tools/pull/70))
22
+ - Update telephone to support simple opening hours ([71](https://github.com/alphagov/govuk_content_block_tools/pull/71))
13
23
 
14
24
  ## 0.13.0
15
25
 
@@ -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
@@ -41,10 +41,10 @@ module ContentBlockTools
41
41
  content_tag(
42
42
  base_tag,
43
43
  content,
44
- class: %W[content-embed content-embed__#{content_block.document_type}],
44
+ class: %W[content-block content-block--#{document_type}],
45
45
  data: {
46
46
  content_block: "",
47
- document_type: content_block.document_type,
47
+ document_type: document_type,
48
48
  content_id: content_block.content_id,
49
49
  embed_code: content_block.embed_code,
50
50
  },
@@ -129,6 +129,10 @@ module ContentBlockTools
129
129
  def embedded_objects
130
130
  self.class.instance_variable_get("@embedded_objects")
131
131
  end
132
+
133
+ def document_type
134
+ content_block.document_type.delete_prefix("content_block_")
135
+ end
132
136
  end
133
137
  end
134
138
  end
@@ -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.14.0"
4
+ VERSION = "0.16.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.14.0
4
+ version: 0.16.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: []