hellobase 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hellobase/formtastic/datepicker_with_time_input.rb +31 -11
- data/lib/hellobase/version.rb +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fa5d3298e71115f9af44ce60b01e81c7cbedbb51afe5403ffcbc7e779ce60a7
|
4
|
+
data.tar.gz: d2d63fc84142ea350639817c1f9cdf0aaeeec1c5eba7abcefdacb2c1f1d50ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29caf1fc217aa49f355208131e58b02f4d05e7c3d14e71d41bd341124791694ebe3c016c171de1fb3a5352bb3ebcf23c4fff4201ddd8dde7a8e875661e3d3151
|
7
|
+
data.tar.gz: e6681810f813af2fe9a531f0bacda90a6858f97fc0ae096d14a305f8889b2220d8531736b05c1cf4c5e5c9a357e58b94787aa5c86ef1c40481cc86dc08dbd015
|
@@ -8,7 +8,7 @@ class DatepickerWithTimeInput
|
|
8
8
|
include ::Formtastic::Inputs::Base
|
9
9
|
|
10
10
|
def self.virtual_attributes(attr)
|
11
|
-
[:"_dpwt_#{attr}_d", :"_dpwt_#{attr}
|
11
|
+
[:"_dpwt_#{attr}_d", :"_dpwt_#{attr}_h", :"_dpwt_#{attr}_m"]
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.define_virtual_attributes(klass, attr)
|
@@ -21,8 +21,12 @@ class DatepickerWithTimeInput
|
|
21
21
|
self.#{attr}&.strftime('%Y-%m-%d')
|
22
22
|
end
|
23
23
|
|
24
|
-
def _dpwt_#{attr}
|
25
|
-
self.#{attr}&.strftime('%
|
24
|
+
def _dpwt_#{attr}_h
|
25
|
+
self.#{attr}&.strftime('%H')
|
26
|
+
end
|
27
|
+
|
28
|
+
def _dpwt_#{attr}_m
|
29
|
+
self.#{attr}&.strftime('%M')
|
26
30
|
end
|
27
31
|
|
28
32
|
def _dpwt_#{attr}_d=(val)
|
@@ -32,8 +36,15 @@ class DatepickerWithTimeInput
|
|
32
36
|
val
|
33
37
|
end
|
34
38
|
|
35
|
-
def _dpwt_#{attr}
|
36
|
-
@_dpwt_#{attr}
|
39
|
+
def _dpwt_#{attr}_h=(val)
|
40
|
+
@_dpwt_#{attr}_h = val
|
41
|
+
_dpwt_set_#{attr}
|
42
|
+
|
43
|
+
val
|
44
|
+
end
|
45
|
+
|
46
|
+
def _dpwt_#{attr}_m=(val)
|
47
|
+
@_dpwt_#{attr}_m = val
|
37
48
|
_dpwt_set_#{attr}
|
38
49
|
|
39
50
|
val
|
@@ -42,19 +53,21 @@ class DatepickerWithTimeInput
|
|
42
53
|
private
|
43
54
|
|
44
55
|
def _dpwt_set_#{attr}
|
45
|
-
self.#{attr} = @_dpwt_#{attr}_d.blank? || @_dpwt_#{attr}
|
56
|
+
self.#{attr} = @_dpwt_#{attr}_d.blank? || @_dpwt_#{attr}_h.blank? || @_dpwt_#{attr}_m.blank? ? nil : [@_dpwt_#{attr}_d, [@_dpwt_#{attr}_h, @_dpwt_#{attr}_m].join(':')].join(' ')
|
46
57
|
end
|
47
58
|
RUBY
|
48
59
|
end
|
49
60
|
|
50
61
|
def to_html
|
51
62
|
datepicker_html = ActiveAdmin::Inputs::DatepickerInput.new(builder, template, object, object_name, :"_dpwt_#{method}_d", datepicker_options).to_html
|
52
|
-
|
63
|
+
hour_select_html = Formtastic::Inputs::SelectInput.new(builder, template, object, object_name, :"_dpwt_#{method}_h", hour_select_options).to_html
|
64
|
+
minute_select_html = Formtastic::Inputs::SelectInput.new(builder, template, object, object_name, :"_dpwt_#{method}_m", minute_select_options).to_html
|
53
65
|
zone_display_html = options[:time_zone] ? template.content_tag(:span, options[:time_zone]) : nil
|
54
66
|
|
55
67
|
wrapper_contents = [
|
56
68
|
replace_li_tag(datepicker_html),
|
57
|
-
replace_li_tag(
|
69
|
+
replace_li_tag(hour_select_html),
|
70
|
+
replace_li_tag(minute_select_html),
|
58
71
|
zone_display_html,
|
59
72
|
error_html,
|
60
73
|
hint_html,
|
@@ -71,11 +84,18 @@ class DatepickerWithTimeInput
|
|
71
84
|
}.merge(options[:datepicker_options] || {})
|
72
85
|
end
|
73
86
|
|
74
|
-
def
|
87
|
+
def hour_select_options
|
88
|
+
{
|
89
|
+
label: false,
|
90
|
+
collection: 0..23
|
91
|
+
}.merge(options[:hour_select_options] || {})
|
92
|
+
end
|
93
|
+
|
94
|
+
def minute_select_options
|
75
95
|
{
|
76
96
|
label: false,
|
77
|
-
collection:
|
78
|
-
}.merge(options[:
|
97
|
+
collection: 0..59,
|
98
|
+
}.merge(options[:minute_select_options] || {})
|
79
99
|
end
|
80
100
|
|
81
101
|
# formtastic inputs generate <li> with no way to override
|
data/lib/hellobase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellobase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -99,9 +99,6 @@ dependencies:
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '5.13'
|
104
|
-
- - "<"
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '5.14'
|
107
104
|
type: :development
|
@@ -109,9 +106,6 @@ dependencies:
|
|
109
106
|
version_requirements: !ruby/object:Gem::Requirement
|
110
107
|
requirements:
|
111
108
|
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '5.13'
|
114
|
-
- - "<"
|
115
109
|
- !ruby/object:Gem::Version
|
116
110
|
version: '5.14'
|
117
111
|
- !ruby/object:Gem::Dependency
|
@@ -184,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
178
|
- !ruby/object:Gem::Version
|
185
179
|
version: '0'
|
186
180
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
181
|
+
rubygems_version: 3.0.8
|
188
182
|
signing_key:
|
189
183
|
specification_version: 4
|
190
184
|
summary: Ruby runtime environment for Hellobase
|