content_block_tools 1.9.1 → 1.10.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 +4 -4
- data/app/components/content_block_tools/contact_component.html.erb +14 -8
- data/app/components/content_block_tools/time_period_component.html.erb +5 -0
- data/app/components/content_block_tools/time_period_component.rb +29 -0
- data/lib/content_block_tools/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 995ae1c7fb38df54eff5b1df0af68aeb8558cee5e587e9334e8e8d4d903703b0
|
|
4
|
+
data.tar.gz: 0fda3eaef6bf5a4009d7e11dc0fb13cf2ddfdf462db070d6865af65123ba7335
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b40e81a30e9e2b9c9c1b22f816911b4886148d7e61347b2ecd8becde453f7a0304f6db89eae4de60ad2d9af65cb607e0d76758028d17373330dc13e56a84f1a
|
|
7
|
+
data.tar.gz: '0783a6f182c878b206847103f7872e4ccfe9263f104f2077f4d8377d48c94b1045292a3523727878f8055541b8715b711d7b1dbe3ce11d0128f80d7640b22bb2'
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<div class="vcard">
|
|
2
2
|
<% if block_type.nil? %>
|
|
3
|
-
|
|
3
|
+
<% if content_block.details[:description] %>
|
|
4
|
+
<div data-diff-key="description">
|
|
5
|
+
<%= render_govspeak(content_block.details[:description]) %>
|
|
6
|
+
</div>
|
|
7
|
+
<% end %>
|
|
4
8
|
<dl class="<%= margin_classes(0) %> <%= padding_classes(0) %>">
|
|
5
|
-
<% items.each do |block_type,
|
|
6
|
-
<
|
|
7
|
-
<%=
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<%=
|
|
11
|
-
|
|
9
|
+
<% items.each do |block_type, key, item| %>
|
|
10
|
+
<div data-diff-key="<%= block_type %>-<%= key %>">
|
|
11
|
+
<dt class="<%= margin_classes(0, 0, 4, 0) %> <%= padding_classes(0) %> <%= font_classes(19, "bold") %>">
|
|
12
|
+
<%= item[:title] %>
|
|
13
|
+
</dt>
|
|
14
|
+
<dd class="<%= margin_classes(0, 0, 6, 0) %>">
|
|
15
|
+
<%= component_for_block_type(block_type).new(item:).render.html_safe %>
|
|
16
|
+
</dd>
|
|
17
|
+
</div>
|
|
12
18
|
<% end %>
|
|
13
19
|
</dl>
|
|
14
20
|
<% else %>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module ContentBlockTools
|
|
2
|
+
class TimePeriodComponent < ContentBlockTools::BaseComponent
|
|
3
|
+
def initialize(content_block:, _block_type: nil, _block_name: nil)
|
|
4
|
+
@content_block = content_block
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def start_date
|
|
8
|
+
presented_date(
|
|
9
|
+
content_block.details.dig(:date_range, :start, :date),
|
|
10
|
+
)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def end_date
|
|
14
|
+
presented_date(
|
|
15
|
+
content_block.details.dig(:date_range, :end, :date),
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
attr_reader :content_block
|
|
22
|
+
|
|
23
|
+
def presented_date(date)
|
|
24
|
+
Presenters::FieldPresenters::TimePeriod::DatePresenter.new(
|
|
25
|
+
date,
|
|
26
|
+
).render
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
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: 1.
|
|
4
|
+
version: 1.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
@@ -186,6 +186,8 @@ files:
|
|
|
186
186
|
- app/components/content_block_tools/contacts/email_address_component.rb
|
|
187
187
|
- app/components/content_block_tools/contacts/telephone_component.html.erb
|
|
188
188
|
- app/components/content_block_tools/contacts/telephone_component.rb
|
|
189
|
+
- app/components/content_block_tools/time_period_component.html.erb
|
|
190
|
+
- app/components/content_block_tools/time_period_component.rb
|
|
189
191
|
- lib/content_block_tools.rb
|
|
190
192
|
- lib/content_block_tools/content_block.rb
|
|
191
193
|
- lib/content_block_tools/content_block_reference.rb
|