hellobase 0.1.8 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
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
|
data/lib/hellobase/formtastic.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'active_support' # formtastic needs ActiveSupport::Autoload
|
2
2
|
require 'formtastic'
|
3
3
|
|
4
|
+
require 'hellobase/formtastic/content_input'
|
5
|
+
require 'hellobase/formtastic/datepicker_with_time_input'
|
4
6
|
require 'hellobase/formtastic/inline_checkbox_input'
|
5
|
-
require 'hellobase/formtastic/read_only_input'
|
6
7
|
require 'hellobase/formtastic/time_of_day_input'
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# require these here so we can load this as a standalone file - see formtastic.rb
|
2
|
+
require 'active_support'
|
3
|
+
require 'formtastic'
|
4
|
+
|
5
|
+
require 'active_admin/inputs'
|
6
|
+
|
7
|
+
class DatepickerWithTimeInput
|
8
|
+
include ::Formtastic::Inputs::Base
|
9
|
+
|
10
|
+
def self.virtual_attributes(attr)
|
11
|
+
[:"_dpwt_#{attr}_d", :"_dpwt_#{attr}_h", :"_dpwt_#{attr}_m"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.define_virtual_attributes(klass, attr)
|
15
|
+
return if klass.respond_to? :_dpwt_defined
|
16
|
+
|
17
|
+
klass.class_eval <<-RUBY
|
18
|
+
def self._dpwt_defined; end
|
19
|
+
|
20
|
+
def _dpwt_#{attr}_d
|
21
|
+
self.#{attr}&.strftime('%Y-%m-%d')
|
22
|
+
end
|
23
|
+
|
24
|
+
def _dpwt_#{attr}_h
|
25
|
+
self.#{attr}&.strftime('%H')
|
26
|
+
end
|
27
|
+
|
28
|
+
def _dpwt_#{attr}_m
|
29
|
+
self.#{attr}&.strftime('%M')
|
30
|
+
end
|
31
|
+
|
32
|
+
def _dpwt_#{attr}_d=(val)
|
33
|
+
@_dpwt_#{attr}_d = val
|
34
|
+
_dpwt_set_#{attr}
|
35
|
+
|
36
|
+
val
|
37
|
+
end
|
38
|
+
|
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
|
48
|
+
_dpwt_set_#{attr}
|
49
|
+
|
50
|
+
val
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def _dpwt_set_#{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(' ')
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_html
|
62
|
+
datepicker_html = ActiveAdmin::Inputs::DatepickerInput.new(builder, template, object, object_name, :"_dpwt_#{method}_d", datepicker_options).to_html
|
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
|
65
|
+
zone_display_html = options[:time_zone] ? template.content_tag(:span, options[:time_zone]) : nil
|
66
|
+
|
67
|
+
wrapper_contents = [
|
68
|
+
replace_li_tag(datepicker_html),
|
69
|
+
replace_li_tag(hour_select_html),
|
70
|
+
replace_li_tag(minute_select_html),
|
71
|
+
zone_display_html,
|
72
|
+
error_html,
|
73
|
+
hint_html,
|
74
|
+
].compact.join("\n").html_safe
|
75
|
+
|
76
|
+
template.content_tag(:li, wrapper_contents, wrapper_html_options)
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def datepicker_options
|
82
|
+
{
|
83
|
+
label: label_text,
|
84
|
+
}.merge(options[:datepicker_options] || {})
|
85
|
+
end
|
86
|
+
|
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
|
95
|
+
{
|
96
|
+
label: false,
|
97
|
+
collection: 0..59,
|
98
|
+
}.merge(options[:minute_select_options] || {})
|
99
|
+
end
|
100
|
+
|
101
|
+
# formtastic inputs generate <li> with no way to override
|
102
|
+
def replace_li_tag(html)
|
103
|
+
html.strip.sub(/^<li /, '<span ').sub(/<\/li>$/, '</span>').html_safe
|
104
|
+
end
|
105
|
+
end
|
data/lib/hellobase/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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
|
-
autorequire:
|
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
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activeadmin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.7'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: activesupport
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,25 +53,75 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '2.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: activemodel
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
|
61
|
+
version: '6.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
49
74
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
75
|
+
version: '6.0'
|
51
76
|
type: :development
|
52
77
|
prerelease: false
|
53
78
|
version_requirements: !ruby/object:Gem::Requirement
|
54
79
|
requirements:
|
55
80
|
- - "~>"
|
56
81
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
58
|
-
|
82
|
+
version: '6.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: actionview
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '6.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '6.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
59
102
|
- !ruby/object:Gem::Version
|
60
103
|
version: '5.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.14'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.10'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.10'
|
61
125
|
- !ruby/object:Gem::Dependency
|
62
126
|
name: warning
|
63
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +136,7 @@ dependencies:
|
|
72
136
|
- - "~>"
|
73
137
|
- !ruby/object:Gem::Version
|
74
138
|
version: '1.0'
|
75
|
-
description:
|
139
|
+
description:
|
76
140
|
email:
|
77
141
|
- awang@hellobase.com
|
78
142
|
executables: []
|
@@ -90,15 +154,16 @@ files:
|
|
90
154
|
- lib/hellobase/core_ext/string_access.rb
|
91
155
|
- lib/hellobase/core_ext/time_creation.rb
|
92
156
|
- lib/hellobase/formtastic.rb
|
157
|
+
- lib/hellobase/formtastic/content_input.rb
|
158
|
+
- lib/hellobase/formtastic/datepicker_with_time_input.rb
|
93
159
|
- lib/hellobase/formtastic/inline_checkbox_input.rb
|
94
|
-
- lib/hellobase/formtastic/read_only_input.rb
|
95
160
|
- lib/hellobase/formtastic/time_of_day_input.rb
|
96
161
|
- lib/hellobase/time_zones.rb
|
97
162
|
- lib/hellobase/version.rb
|
98
|
-
homepage:
|
163
|
+
homepage:
|
99
164
|
licenses: []
|
100
165
|
metadata: {}
|
101
|
-
post_install_message:
|
166
|
+
post_install_message:
|
102
167
|
rdoc_options: []
|
103
168
|
require_paths:
|
104
169
|
- lib
|
@@ -113,9 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
178
|
- !ruby/object:Gem::Version
|
114
179
|
version: '0'
|
115
180
|
requirements: []
|
116
|
-
|
117
|
-
|
118
|
-
signing_key:
|
181
|
+
rubygems_version: 3.0.8
|
182
|
+
signing_key:
|
119
183
|
specification_version: 4
|
120
184
|
summary: Ruby runtime environment for Hellobase
|
121
185
|
test_files: []
|