content_block_tools 0.8.0 → 0.9.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: 899485acaf4c5c55bdeb7e8803501ce4e0ce3f2a4145b008418ca10cf955580c
4
- data.tar.gz: 3e128c92ce7e7cb9cf1319b6c04b968a30512fd44a42597f557575a56d288569
3
+ metadata.gz: 565c412328ad54e9e45ca5ce473e6876147543cf88900dafde91083042c6b0ab
4
+ data.tar.gz: 8de3aab0cbfb65213cf1dceadd420ebdd1c006d6f9e715963bb6e49383617b1b
5
5
  SHA512:
6
- metadata.gz: 3d02b0d69c9d14a1edaade41d7ef3f573a94647f533f14542ead97e0cb7d9315e56c1f7d91a05b8723831c34b79e2b26fbe9ed1ccaf589cbc870d88cd11b9e53
7
- data.tar.gz: 01bcb437e45fd6a77f305e59d56cbd6b267e1a7e83058037a8d002b940e82ab70d63f3d6d66780d5b4fd318999efdadf97b1063e45b8d184716d73a73f0741a7
6
+ metadata.gz: ffda22c0d89798cea8b029ee90c2bc65564ab25fe7de67047251aafd53b01b1a7f127bc5c4af9deebba2e21e968767380dbde01993d9d9143394f7e0308ad5a4
7
+ data.tar.gz: '07429aa7168f233ca8935cf7c20c4e30221bdf0a1970f4376ffa30214e5bd09307509f331e97fd86e30d8babe94c7e4242c5a2cfe757dc0bfacf00a4362e351b'
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.9.0
11
+
12
+ - Render addresses within a `contact` div ([58](https://github.com/alphagov/govuk_content_block_tools/pull/58))
13
+
10
14
  ## 0.8.0
11
15
 
12
16
  - Add wrapper classes to contact sub-blocks ([57](https://github.com/alphagov/govuk_content_block_tools/pull/57))
@@ -1,15 +1,31 @@
1
+ require_relative "./block_level_contact_item"
2
+
1
3
  module ContentBlockTools
2
4
  module Presenters
3
5
  module BlockPresenters
4
6
  module Contact
5
7
  class AddressPresenter < ContentBlockTools::Presenters::BlockPresenters::BasePresenter
8
+ include ContentBlockTools::Presenters::BlockPresenters::Contact::BlockLevelContactItem
9
+
6
10
  def render
7
- content_tag(:p, class: "adr") do
8
- %i[street_address locality region postal_code country].map { |field|
9
- next if item[field].blank?
11
+ wrapper do
12
+ content_tag(:p, class: "adr") do
13
+ %i[street_address locality region postal_code country].map { |field|
14
+ next if item[field].blank?
15
+
16
+ content_tag(:span, item[field], { class: class_for_field_name(field) })
17
+ }.compact_blank.join(",<br/>").html_safe
18
+ end
19
+ end
20
+ end
10
21
 
11
- content_tag(:span, item[field], { class: class_for_field_name(field) })
12
- }.compact_blank.join(",<br/>").html_safe
22
+ def wrapper(&block)
23
+ if @rendering_context == :field_names
24
+ content_tag(:div, class: "contact") do
25
+ yield block
26
+ end
27
+ else
28
+ yield block
13
29
  end
14
30
  end
15
31
 
@@ -13,14 +13,10 @@ module ContentBlockTools
13
13
  def wrapper(&block)
14
14
  if @rendering_context == :field_names
15
15
  content_tag(:div, class: "contact") do
16
- content_tag(:div, class: "email-url-number") do
17
- yield block
18
- end
19
- end
20
- else
21
- content_tag(:div, class: "email-url-number") do
22
16
  yield block
23
17
  end
18
+ else
19
+ yield block
24
20
  end
25
21
  end
26
22
  end
@@ -9,12 +9,14 @@ module ContentBlockTools
9
9
 
10
10
  def render
11
11
  wrapper do
12
- content_tag(:p) do
13
- concat content_tag(:span, item[:title])
14
- concat content_tag(:a,
15
- item[:url],
16
- class: "url",
17
- href: item[:url])
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
18
20
  end
19
21
  end
20
22
  end
@@ -9,12 +9,14 @@ module ContentBlockTools
9
9
 
10
10
  def render
11
11
  wrapper do
12
- content_tag(:p) do
13
- concat content_tag(:span, item[:title])
14
- concat content_tag(:a,
15
- item[:email_address],
16
- class: "email",
17
- href: "mailto:#{item[:email_address]}")
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[:email_address],
17
+ class: "email",
18
+ href: "mailto:#{item[:email_address]}")
19
+ end
18
20
  end
19
21
  end
20
22
  end
@@ -9,9 +9,11 @@ module ContentBlockTools
9
9
 
10
10
  def render
11
11
  wrapper do
12
- concat number_list
13
- concat opening_hours_list if item[:opening_hours].present?
14
- concat call_charges_link
12
+ content_tag(:div, class: "email-url-number") do
13
+ concat number_list
14
+ concat opening_hours_list if item[:opening_hours].present?
15
+ concat call_charges_link
16
+ end
15
17
  end
16
18
  end
17
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContentBlockTools
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev