content_block_tools 0.5.3 → 0.5.4
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/lib/content_block_tools/content_block.rb +3 -5
- data/lib/content_block_tools/content_block_reference.rb +3 -3
- data/lib/content_block_tools/version.rb +1 -1
- data/lib/content_block_tools.rb +0 -2
- metadata +1 -3
- data/lib/content_block_tools/presenters/email_address_presenter.rb +0 -14
- data/lib/content_block_tools/presenters/postal_address_presenter.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 317a33abd963522a97d5421d905b916f8c178935645081bba320b984ed0108b4
|
4
|
+
data.tar.gz: 9503e913fb0c5826cfbafae81e7263351e149b44009e0bb836ac1d1dc00c8ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716b6950c8633ccc8f80eba30d685e117ce638471f9eadc5c7353e8189a2e2d0eb263e86dd4f6e340cc68d3c54b234e758fc3211ff0078e5ab0dba12c298695e
|
7
|
+
data.tar.gz: '078faf1ebb791e906f33744cf8dd0f3a6a8c5355c5b2296926bc68eaccff13c931df39786ac59b5af9958fbe61b7162a9868cb50edf5afb94e4b7f33a06f39d5'
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@
|
|
7
7
|
useful summary for people upgrading their application, not a replication
|
8
8
|
of the commit log.
|
9
9
|
|
10
|
+
## 0.5.4
|
11
|
+
|
12
|
+
- Remove old email_address and postal_address types ([38](https://github.com/alphagov/govuk_content_block_tools/pull/38))
|
13
|
+
|
10
14
|
## 0.5.3
|
11
15
|
|
12
16
|
- Add spacing to contact item titles ([35](https://github.com/alphagov/govuk_content_block_tools/pull/35))
|
data/README.md
CHANGED
@@ -19,13 +19,13 @@ or add it to your Gemfile
|
|
19
19
|
To find embed code in a block of text, use `ContentBlockReference.find_all_in_document`:
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
content = "Hello - here is a embed code {{embed:
|
22
|
+
content = "Hello - here is a embed code {{embed:content_block_pension:be24ee44-b636-4a3e-b979-0da27b4a8e62}}"
|
23
23
|
ContentBlockReference.find_all_in_document(content)
|
24
24
|
# =>
|
25
25
|
#[#<data ContentBlockTools::ContentBlockReference
|
26
|
-
# document_type="
|
26
|
+
# document_type="content_block_pension",
|
27
27
|
# content_id="be24ee44-b636-4a3e-b979-0da27b4a8e62",
|
28
|
-
# embed_code="{{embed:
|
28
|
+
# embed_code="{{embed:content_block_pension:be24ee44-b636-4a3e-b979-0da27b4a8e62}}">]
|
29
29
|
```
|
30
30
|
|
31
31
|
### Rendering a content block
|
@@ -23,7 +23,7 @@ module ContentBlockTools
|
|
23
23
|
# will be used to render the content block. All supported document_types are documented in
|
24
24
|
# {ContentBlockTools::ContentBlockReference::SUPPORTED_DOCUMENT_TYPES}
|
25
25
|
# @example
|
26
|
-
# content_block.document_type #=> "
|
26
|
+
# content_block.document_type #=> "content_block_pension"
|
27
27
|
# @return [String] the document type
|
28
28
|
# @api public
|
29
29
|
#
|
@@ -37,15 +37,13 @@ module ContentBlockTools
|
|
37
37
|
# @!attribute [r] embed_code
|
38
38
|
# The embed_code used for a block containing optional field name
|
39
39
|
# @example
|
40
|
-
# content_block_reference.embed_code #=> "{{embed:
|
41
|
-
# content_block_reference.embed_code #=> "{{embed:
|
40
|
+
# content_block_reference.embed_code #=> "{{embed:content_block_pension:2b92cade-549c-4449-9796-e7a3957f3a86}}"
|
41
|
+
# content_block_reference.embed_code #=> "{{embed:content_block_contact:2b92cade-549c-4449-9796-e7a3957f3a86/field_name}}"
|
42
42
|
# @return [String]
|
43
43
|
class ContentBlock < Data
|
44
44
|
# A lookup of presenters for particular content block types
|
45
45
|
CONTENT_PRESENTERS = {
|
46
46
|
"content_block_contact" => ContentBlockTools::Presenters::ContactPresenter,
|
47
|
-
"content_block_email_address" => ContentBlockTools::Presenters::EmailAddressPresenter,
|
48
|
-
"content_block_postal_address" => ContentBlockTools::Presenters::PostalAddressPresenter,
|
49
47
|
"content_block_pension" => ContentBlockTools::Presenters::PensionPresenter,
|
50
48
|
}.freeze
|
51
49
|
|
@@ -9,7 +9,7 @@ module ContentBlockTools
|
|
9
9
|
# will be used to render the content block. All supported document_types are documented in
|
10
10
|
# {ContentBlockTools::ContentBlockReference::SUPPORTED_DOCUMENT_TYPES}
|
11
11
|
# @example
|
12
|
-
# content_block_reference.document_type #=> "
|
12
|
+
# content_block_reference.document_type #=> "content_block_pension"
|
13
13
|
# @return [String] the document type
|
14
14
|
# @api public
|
15
15
|
#
|
@@ -24,11 +24,11 @@ module ContentBlockTools
|
|
24
24
|
# @!attribute [r] embed_code
|
25
25
|
# The embed_code used for a block
|
26
26
|
# @example
|
27
|
-
# content_block_reference.embed_code #=> "{{embed:
|
27
|
+
# content_block_reference.embed_code #=> "{{embed:content_block_pension:2b92cade-549c-4449-9796-e7a3957f3a86}}"
|
28
28
|
# @return [String]
|
29
29
|
class ContentBlockReference < Data
|
30
30
|
# An array of the supported document types
|
31
|
-
SUPPORTED_DOCUMENT_TYPES = %w[contact
|
31
|
+
SUPPORTED_DOCUMENT_TYPES = %w[contact content_block_pension content_block_contact].freeze
|
32
32
|
# The regex used to find UUIDs
|
33
33
|
UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
|
34
34
|
# The regex used to find content ID aliases
|
data/lib/content_block_tools.rb
CHANGED
@@ -14,8 +14,6 @@ require "content_block_tools/presenters/block_presenters/contact/telephone_prese
|
|
14
14
|
|
15
15
|
require "content_block_tools/presenters/base_presenter"
|
16
16
|
require "content_block_tools/presenters/contact_presenter"
|
17
|
-
require "content_block_tools/presenters/email_address_presenter"
|
18
|
-
require "content_block_tools/presenters/postal_address_presenter"
|
19
17
|
require "content_block_tools/presenters/pension_presenter"
|
20
18
|
|
21
19
|
require "content_block_tools/content_block"
|
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.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
@@ -112,11 +112,9 @@ files:
|
|
112
112
|
- lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb
|
113
113
|
- lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb
|
114
114
|
- lib/content_block_tools/presenters/contact_presenter.rb
|
115
|
-
- lib/content_block_tools/presenters/email_address_presenter.rb
|
116
115
|
- lib/content_block_tools/presenters/field_presenters/base_presenter.rb
|
117
116
|
- lib/content_block_tools/presenters/field_presenters/contact/email_address_presenter.rb
|
118
117
|
- lib/content_block_tools/presenters/pension_presenter.rb
|
119
|
-
- lib/content_block_tools/presenters/postal_address_presenter.rb
|
120
118
|
- lib/content_block_tools/version.rb
|
121
119
|
homepage: https://github.com/alphagov/content_block_tools
|
122
120
|
licenses:
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module ContentBlockTools
|
2
|
-
module Presenters
|
3
|
-
class EmailAddressPresenter < BasePresenter
|
4
|
-
private
|
5
|
-
|
6
|
-
def content
|
7
|
-
content_tag(:a,
|
8
|
-
content_block.details[:email_address],
|
9
|
-
class: "govuk-link",
|
10
|
-
href: "mailto:#{content_block.details[:email_address]}")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module ContentBlockTools
|
2
|
-
module Presenters
|
3
|
-
class PostalAddressPresenter < BasePresenter
|
4
|
-
private
|
5
|
-
|
6
|
-
def default_content
|
7
|
-
"#{content_block.details[:line_1]}, #{content_block.details[:town_or_city]}, #{content_block.details[:postcode]}"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|