hellobase-formtastic 0.2.0 → 0.3.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: 9a6709435108ea76c05c1a914d7de6130d8b2fa24d86df30332ec4c485e92a1e
4
- data.tar.gz: 9d85ba91be22e249e95810d78ba805cd7caf84de03e64bc1fff6d47d8375e4ca
3
+ metadata.gz: 23204b79fccf4dbacbe9826a220766e0604923a959673771c8fc38bc6240997e
4
+ data.tar.gz: f13d31c76387f8646d180dcf65482b85c38cf742de6297b4dcb07a1b0b4fe5a3
5
5
  SHA512:
6
- metadata.gz: 0db3da06a01a65b1a8a91ba4e628b3fbd9fa5925bf4cd01d37fba417a0f52059407314c50af31b59ca6e90b49412ac6b5d9580396bfe2a75ba2aa7552971ead2
7
- data.tar.gz: de834bfc586a0300774efd8f2ed1f394fb983b8b06ae8ebb195a208e16a5484b8d2507120e624e298abdf116aea4531ec39761c9b196a18bc80965b12b26b10a
6
+ metadata.gz: d9561afc8619c56078637790305dc024d0a19e39e58a4b25942ae76ef3a09cd434c1bbe8d3389068dc276709254d1a79fa820973ab911cdc65bfb0318a31a5b8
7
+ data.tar.gz: 2e5725f7722d104c5ddecdb173614b7457338eb2030802521045842dcea08adcbaac3c27062bf4dcb2fc49b55040d231624712a9fa0e9d5206aad33393738498
@@ -7,7 +7,7 @@ module Hellobase
7
7
  include ::Formtastic::Inputs::Base
8
8
 
9
9
  def self.virtual_attributes(base)
10
- [:"_dpwt_#{base}_d", :"_dpwt_#{base}_h", :"_dpwt_#{base}_m"]
10
+ [:"_dpwt_#{base}_d", :"_dpwt_#{base}_h", :"_dpwt_#{base}_m", :"_dpwt_#{base}_z"]
11
11
  end
12
12
 
13
13
  def self.define_virtual_attributes(klass, base)
@@ -28,6 +28,10 @@ module Hellobase
28
28
  send(base)&.strftime('%M')
29
29
  end
30
30
 
31
+ define_method attrs[3] do
32
+ send(base)&.strftime('%Z')
33
+ end
34
+
31
35
  attrs.each_with_index do |a, i|
32
36
  define_method :"#{a}=" do |val|
33
37
  instance_variable_set ivars[i], val
@@ -46,7 +50,8 @@ module Hellobase
46
50
  [
47
51
  instance_variable_get(ivars[1]),
48
52
  instance_variable_get(ivars[2])
49
- ].join(':')
53
+ ].join(':'),
54
+ instance_variable_get(ivars[3]),
50
55
  ].join(' ')
51
56
  end
52
57
 
@@ -58,13 +63,17 @@ module Hellobase
58
63
  datepicker_html = ::ActiveAdmin::Inputs::DatepickerInput.new(builder, template, object, object_name, :"_dpwt_#{method}_d", datepicker_options).to_html
59
64
  hour_select_html = ::Formtastic::Inputs::SelectInput.new(builder, template, object, object_name, :"_dpwt_#{method}_h", hour_select_options).to_html
60
65
  minute_select_html = ::Formtastic::Inputs::SelectInput.new(builder, template, object, object_name, :"_dpwt_#{method}_m", minute_select_options).to_html
61
- zone_display_html = options[:time_zone] ? template.content_tag(:span, options[:time_zone]) : nil
66
+
67
+ timezone = options[:timezone] || 'UTC'
68
+ timezone_span_html = template.content_tag(:span, timezone, id: "#{object_name}__dpwt_#{method}_timezone")
69
+ timezone_hidden_input_html = template.hidden_field_tag("#{object_name}[_dpwt_#{method}_z]", timezone, :id => "#{object_name}__dpwt_#{method}_z")
62
70
 
63
71
  wrapper_contents = [
64
72
  replace_li_tag(datepicker_html),
65
73
  replace_li_tag(hour_select_html),
66
74
  replace_li_tag(minute_select_html),
67
- zone_display_html,
75
+ timezone_span_html,
76
+ timezone_hidden_input_html,
68
77
  error_html,
69
78
  hint_html,
70
79
  ].compact.join("\n").html_safe
@@ -1,5 +1,5 @@
1
1
  module Hellobase
2
2
  module Formtastic
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hellobase-formtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2025-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubygems_version: 3.2.32
161
+ rubygems_version: 3.1.6
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Custom Formtastic inputs