govuk_publishing_components 23.10.1 → 23.10.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 737265f42ca1a81cb1a854d9858c053b36da1dd49096d4ab271880e40a0d265a
|
4
|
+
data.tar.gz: 53e08f6b824be9665c54eb1e421463d63d8a761cc0aa8b432fdea43025fe173f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d668236b7496da22426217927da594ff3dc3da9a903fafe647ca9ab47cc7877d779aef7dd841dde4b1f514571155a149a8d81bc40ff0b4e506ec8d90eeb6b80b
|
7
|
+
data.tar.gz: 5ea78e25ed6a8ca39346ce90b46262b96c793ebd0fcc84a83715378099f029aa2c72bc29f758ba1b414d81fc7a73a3b21e7bd35603313d621d8c7fb112b1364f
|
@@ -37,15 +37,17 @@ require "govuk_publishing_components/app_helpers/brand_helper"
|
|
37
37
|
require "govuk_publishing_components/app_helpers/countdown_helper"
|
38
38
|
require "govuk_publishing_components/app_helpers/environment"
|
39
39
|
|
40
|
-
# Add
|
41
|
-
ActionController::Base.append_view_path(
|
42
|
-
File.expand_path("app/views", GovukPublishingComponents::Config.gem_directory),
|
43
|
-
)
|
44
|
-
|
40
|
+
# Add i18n paths and views for usage outside of a Rails app
|
45
41
|
I18n.load_path.unshift(
|
46
42
|
*Dir.glob(File.expand_path("config/locales/*.yml", GovukPublishingComponents::Config.gem_directory)),
|
47
43
|
)
|
48
44
|
|
45
|
+
ActiveSupport.on_load(:action_controller) do
|
46
|
+
ActionController::Base.append_view_path(
|
47
|
+
File.expand_path("app/views", GovukPublishingComponents::Config.gem_directory),
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
49
51
|
module GovukPublishingComponents
|
50
52
|
def self.render(component, options = {})
|
51
53
|
I18n.with_locale(options.fetch(:locale, "en")) do
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module GovukPublishingComponents
|
2
2
|
module AppHelpers
|
3
3
|
class CountdownHelper
|
4
|
-
|
4
|
+
DEADLINE = Time.new(2020, 12, 31, 23, 59)
|
5
5
|
|
6
6
|
def days_left
|
7
|
-
sprintf "%02d",
|
7
|
+
sprintf "%02d", days_left_until_deadline
|
8
8
|
end
|
9
9
|
|
10
10
|
def show?
|
11
|
-
|
11
|
+
minutes_left_until_deadline >= 30
|
12
12
|
end
|
13
13
|
|
14
14
|
def days_text
|
15
|
-
if
|
15
|
+
if days_left_until_deadline == 1
|
16
16
|
I18n.t!("components.transition_countdown.day_to_go")
|
17
17
|
else
|
18
18
|
I18n.t!("components.transition_countdown.days_to_go")
|
@@ -21,12 +21,28 @@ module GovukPublishingComponents
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def
|
25
|
-
(
|
24
|
+
def days_left_until_deadline
|
25
|
+
(minutes_left_until_deadline / 60 / 24).ceil
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def minutes_left_until_deadline
|
29
|
+
(seconds_left_until_deadline / 60)
|
30
|
+
end
|
31
|
+
|
32
|
+
def seconds_left_until_deadline
|
33
|
+
end_of_transition_period - now_in_london
|
34
|
+
end
|
35
|
+
|
36
|
+
def end_of_transition_period
|
37
|
+
london_time_zone(DEADLINE)
|
38
|
+
end
|
39
|
+
|
40
|
+
def now_in_london
|
41
|
+
london_time_zone(Time.now)
|
42
|
+
end
|
43
|
+
|
44
|
+
def london_time_zone(time)
|
45
|
+
time.in_time_zone("Europe/London")
|
30
46
|
end
|
31
47
|
end
|
32
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 23.10.
|
4
|
+
version: 23.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|