content_block_tools 0.4.2 → 0.4.4

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: efd943f4be9e4e03e81aa3303b2bb61e503bfa104ff026ac8b8cea07235b4b46
4
- data.tar.gz: 322186e3603ee524727b94f2a8da3d42fc9f961fd2d072266d82cdd2240d6d78
3
+ metadata.gz: 590deefd4541eee270592e6490d44140ede0fc10ed6333d348052afebd949a68
4
+ data.tar.gz: 94e1064ffaef327f90a48c1f06d45e6bb95718325ba9cbdaf0d535bb82d8e1e3
5
5
  SHA512:
6
- metadata.gz: 216e1a3f218bec821d23cb7ba310b9e1d96162f2e0e24bade0edc00fe030e4990aa6167774ad9ac103d9cf435ebcacdc85e427d6e3b803c9e3ddc4486e639a98
7
- data.tar.gz: 23a471d39e89bd2f92b67871acd0140e37170f76d803e8b240fb225891ed28d7f944c132b0c83a5ce1b07e299df3dea193b4f80e104b84ab4353b85c97c279c5
6
+ metadata.gz: 890262fb9673b49caec318e0fe55ea30a723a0433ba5fb94166a97bf0ef3692c0cc483d5a3749fe3b250b42234ae7e0fe65bb472b203c3ca109aeae7655321f1
7
+ data.tar.gz: 0e6c72ecf5c5a7adfb587388f3c065e6b35bdcf7226807a79c99eb339cc06f231396610be3fe5ac1fd6957127fcd1a2e2f2145a3c53444d6e1c55bee0c46fcf2
@@ -34,6 +34,15 @@ jobs:
34
34
  bundler-cache: true
35
35
  - run: bundle exec rake
36
36
 
37
+ # Branch protection rules cannot directly depend on status checks from matrix jobs.
38
+ # So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed.
39
+ # Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3
40
+ test:
41
+ needs: test_matrix
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - run: echo "All matrix tests have passed 🚀"
45
+
37
46
  publish:
38
47
  needs: test_matrix
39
48
  if: ${{ github.ref == 'refs/heads/main' }}
data/CHANGELOG.md CHANGED
@@ -7,36 +7,44 @@
7
7
  useful summary for people upgrading their application, not a replication
8
8
  of the commit log.
9
9
 
10
+ ## 0.4.4
11
+
12
+ - symbolize keys in block details blob, in order to find embedded nested fields ([22](https://github.com/alphagov/govuk_content_block_tools/pull/22))
13
+
14
+ ## 0.4.3
15
+
16
+ - Add presenter for a pension block ([20](https://github.com/alphagov/govuk_content_block_tools/pull/20))
17
+
10
18
  ## 0.4.2
11
19
 
12
- * Pass embed code to HTML span ([19](https://github.com/alphagov/govuk_content_block_tools/pull/19))
20
+ - Pass embed code to HTML span ([19](https://github.com/alphagov/govuk_content_block_tools/pull/19))
13
21
 
14
22
  ## 0.4.1
15
23
 
16
- * Fix field regular expression ([18](https://github.com/alphagov/govuk_content_block_tools/pull/18))
24
+ - Fix field regular expression ([18](https://github.com/alphagov/govuk_content_block_tools/pull/18))
17
25
 
18
26
  ## 0.4.0
19
27
 
20
- * BREAKING: allow support for field names in block's embed code. new ContentBlocks now require an embed code argument. (
28
+ - BREAKING: allow support for field names in block's embed code. new ContentBlocks now require an embed code argument. (
21
29
  [17]
22
30
  (https://github.com/alphagov/govuk_content_block_tools/pull/17))
23
31
 
24
32
  ## 0.3.1
25
33
 
26
- * Support any Rails version `>= 6` ([#10](https://github.com/alphagov/govuk_content_block_tools/pull/10))
34
+ - Support any Rails version `>= 6` ([#10](https://github.com/alphagov/govuk_content_block_tools/pull/10))
27
35
 
28
36
  ## 0.3.0
29
37
 
30
- * Symbolise details hash ([#8](https://github.com/alphagov/content_block_tools/pull/8))
38
+ - Symbolise details hash ([#8](https://github.com/alphagov/content_block_tools/pull/8))
31
39
 
32
40
  ## 0.2.1
33
41
 
34
- * Loosen ActionView dependency ([#7](https://github.com/alphagov/content_block_tools/pull/7))
42
+ - Loosen ActionView dependency ([#7](https://github.com/alphagov/content_block_tools/pull/7))
35
43
 
36
44
  ## 0.2.0
37
45
 
38
- * Don't `uniq` content references ([#6](https://github.com/alphagov/content_block_tools/pull/6))
46
+ - Don't `uniq` content references ([#6](https://github.com/alphagov/content_block_tools/pull/6))
39
47
 
40
48
  ## 0.1.0
41
49
 
42
- * Initial release
50
+ - Initial release
@@ -45,6 +45,7 @@ module ContentBlockTools
45
45
  CONTENT_PRESENTERS = {
46
46
  "content_block_email_address" => ContentBlockTools::Presenters::EmailAddressPresenter,
47
47
  "content_block_postal_address" => ContentBlockTools::Presenters::PostalAddressPresenter,
48
+ "content_block_pension" => ContentBlockTools::Presenters::PensionPresenter,
48
49
  }.freeze
49
50
 
50
51
  # Calls the appropriate presenter class to return a HTML representation of a content
@@ -26,7 +26,7 @@ module ContentBlockTools
26
26
  # @return [String]
27
27
  class ContentBlockReference < Data
28
28
  # An array of the supported document types
29
- SUPPORTED_DOCUMENT_TYPES = %w[contact content_block_email_address content_block_postal_address].freeze
29
+ SUPPORTED_DOCUMENT_TYPES = %w[contact content_block_email_address content_block_postal_address content_block_pension].freeze
30
30
  # The regex used to find UUIDs
31
31
  UUID_REGEX = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/
32
32
  # The regex to find optional field names after the UUID, begins with '/'
@@ -56,7 +56,7 @@ module ContentBlockTools
56
56
  end
57
57
 
58
58
  def content_for_fields
59
- content_block.details.dig(*field_names)
59
+ content_block.details.deep_symbolize_keys.dig(*field_names)
60
60
  end
61
61
 
62
62
  def field_names
@@ -0,0 +1,11 @@
1
+ module ContentBlockTools
2
+ module Presenters
3
+ class PensionPresenter < BasePresenter
4
+ private
5
+
6
+ def default_content
7
+ content_block.title
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContentBlockTools
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.4"
5
5
  end
@@ -6,6 +6,7 @@ require "uri"
6
6
  require "content_block_tools/presenters/base_presenter"
7
7
  require "content_block_tools/presenters/email_address_presenter"
8
8
  require "content_block_tools/presenters/postal_address_presenter"
9
+ require "content_block_tools/presenters/pension_presenter"
9
10
 
10
11
  require "content_block_tools/content_block"
11
12
  require "content_block_tools/content_block_reference"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: content_block_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-06 00:00:00.000000000 Z
10
+ date: 2025-02-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -92,6 +92,7 @@ files:
92
92
  - lib/content_block_tools/content_block_reference.rb
93
93
  - lib/content_block_tools/presenters/base_presenter.rb
94
94
  - lib/content_block_tools/presenters/email_address_presenter.rb
95
+ - lib/content_block_tools/presenters/pension_presenter.rb
95
96
  - lib/content_block_tools/presenters/postal_address_presenter.rb
96
97
  - lib/content_block_tools/version.rb
97
98
  homepage: https://github.com/alphagov/content_block_tools