content_block_tools 1.8.2 → 1.9.1
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/lib/content_block_tools/content_block_reference.rb +8 -1
- data/lib/content_block_tools/presenters/field_presenters/time_period/date_presenter.rb +14 -0
- data/lib/content_block_tools/presenters/field_presenters/time_period/time_presenter.rb +24 -0
- data/lib/content_block_tools/version.rb +1 -1
- data/lib/content_block_tools.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e50657a9e305421a79ca23cd7720452747b391c2e9fddb3161f2f54f4edf1bc2
|
|
4
|
+
data.tar.gz: c0b154b766abdc488a3ce96bcffaadb7fd7a2218e0b8f5017965ae563f9068f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf33728eec2476f0187debb97ea2b3e752bcc6c822d4489527459bc8c51d84ae3ab1cd800c6bc31bbab565b04dcbd1c44f2dce61483a60a27efb81de99156c8c
|
|
7
|
+
data.tar.gz: a8406089740ab6c854fd9d7b73f00d9293ff12e09aea269de8fa249d2c0d94e3f4405fe06a67f0810f770b51a98cee287a81ab4c6266801895a7f7fc4c11e432
|
|
@@ -28,7 +28,14 @@ module ContentBlockTools
|
|
|
28
28
|
# @return [String]
|
|
29
29
|
class ContentBlockReference < Data
|
|
30
30
|
# An array of the supported document types
|
|
31
|
-
SUPPORTED_DOCUMENT_TYPES = %w[
|
|
31
|
+
SUPPORTED_DOCUMENT_TYPES = %w[
|
|
32
|
+
contact
|
|
33
|
+
content_block_pension
|
|
34
|
+
content_block_contact
|
|
35
|
+
content_block_tax
|
|
36
|
+
content_block_time_period
|
|
37
|
+
].freeze
|
|
38
|
+
|
|
32
39
|
# The regex used to find UUIDs
|
|
33
40
|
UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
|
|
34
41
|
# The regex used to find content ID aliases
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module ContentBlockTools
|
|
2
|
+
module Presenters
|
|
3
|
+
module FieldPresenters
|
|
4
|
+
module TimePeriod
|
|
5
|
+
class TimePresenter < BasePresenter
|
|
6
|
+
def render
|
|
7
|
+
time = Time.parse(field)
|
|
8
|
+
hour = time.strftime("%H")
|
|
9
|
+
minute = time.strftime("%M")
|
|
10
|
+
|
|
11
|
+
if minute == "00"
|
|
12
|
+
return "midday" if hour == "12"
|
|
13
|
+
return "midnight" if hour == "00"
|
|
14
|
+
|
|
15
|
+
return time.strftime("%l%P").strip
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
time.strftime("%l:%M%P").strip
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/content_block_tools.rb
CHANGED
|
@@ -10,6 +10,8 @@ require "content_block_tools/helpers/override_classes"
|
|
|
10
10
|
|
|
11
11
|
require "content_block_tools/presenters/field_presenters/base_presenter"
|
|
12
12
|
require "content_block_tools/presenters/field_presenters/contact/email_presenter"
|
|
13
|
+
require "content_block_tools/presenters/field_presenters/time_period/date_presenter"
|
|
14
|
+
require "content_block_tools/presenters/field_presenters/time_period/time_presenter"
|
|
13
15
|
|
|
14
16
|
require "content_block_tools/content_block"
|
|
15
17
|
require "content_block_tools/content_block_reference"
|
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.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
@@ -194,6 +194,8 @@ files:
|
|
|
194
194
|
- lib/content_block_tools/helpers/override_classes.rb
|
|
195
195
|
- lib/content_block_tools/presenters/field_presenters/base_presenter.rb
|
|
196
196
|
- lib/content_block_tools/presenters/field_presenters/contact/email_presenter.rb
|
|
197
|
+
- lib/content_block_tools/presenters/field_presenters/time_period/date_presenter.rb
|
|
198
|
+
- lib/content_block_tools/presenters/field_presenters/time_period/time_presenter.rb
|
|
197
199
|
- lib/content_block_tools/version.rb
|
|
198
200
|
- node_modules/govuk-frontend/README.md
|
|
199
201
|
- node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js
|
|
@@ -1061,7 +1063,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1061
1063
|
- !ruby/object:Gem::Version
|
|
1062
1064
|
version: '0'
|
|
1063
1065
|
requirements: []
|
|
1064
|
-
rubygems_version: 4.0.
|
|
1066
|
+
rubygems_version: 4.0.7
|
|
1065
1067
|
specification_version: 4
|
|
1066
1068
|
summary: A suite of tools for working with GOV.UK Content Blocks
|
|
1067
1069
|
test_files: []
|