phlexi-form 0.5.9 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phlexi/form/components/input.rb +6 -3
- data/lib/phlexi/form/options/max.rb +4 -4
- data/lib/phlexi/form/options/min.rb +4 -4
- data/lib/phlexi/form/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90eefb63575ca59ebab859b3d025e4894b694553f0875848238f25c6d39d01e
|
4
|
+
data.tar.gz: 3f972bace2dd06428f6ec851828ceb61230332e34506c0852281182709581532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ebaa7e33876dea848848a2fbf1ab1d024c24a3e074a34fd11d2ad18abb650ca09aae721bebb56c7993709b193d9b8ddf740613bff5274ebec9583715fb0d62
|
7
|
+
data.tar.gz: 48e3363a023875c61790f5173edf95e898b778709e01c4d3d156b95afc8e5a60960fd1d1f7ef4d05ce1b55ce49b99fdef71584f619c71ec21c63fe485f9d523e
|
@@ -23,7 +23,7 @@ module Phlexi
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def build_input_attributes
|
26
|
-
attributes.fetch(:type) { attributes[:type] = field.inferred_string_field_type }
|
26
|
+
attributes.fetch(:type) { attributes[:type] = field.inferred_string_field_type || field.inferred_field_type }
|
27
27
|
attributes.fetch(:disabled) { attributes[:disabled] = field.disabled? }
|
28
28
|
|
29
29
|
case attributes[:type]
|
@@ -50,13 +50,15 @@ module Phlexi
|
|
50
50
|
attributes.fetch(:autofocus) { attributes[:autofocus] = field.focused? }
|
51
51
|
attributes.fetch(:required) { attributes[:required] = field.required? }
|
52
52
|
attributes.fetch(:multiple) { attributes[:multiple] = field.multiple? }
|
53
|
-
when :date, :time, :"datetime-local"
|
53
|
+
when :date, :time, :"datetime-local", :datetime
|
54
54
|
attributes.fetch(:autofocus) { attributes[:autofocus] = field.focused? }
|
55
55
|
attributes.fetch(:readonly) { attributes[:readonly] = field.readonly? }
|
56
56
|
attributes.fetch(:required) { attributes[:required] = field.required? }
|
57
57
|
attributes.fetch(:min) { attributes[:min] = field.min }
|
58
58
|
attributes.fetch(:max) { attributes[:max] = field.max }
|
59
59
|
|
60
|
+
attributes[:type] = :"datetime-local" if attributes[:type] == :datetime
|
61
|
+
|
60
62
|
# TODO: Investigate if this is Timezone complaint
|
61
63
|
if field.value.respond_to?(:strftime)
|
62
64
|
attributes[:value] = case attributes[:type]
|
@@ -81,7 +83,8 @@ module Phlexi
|
|
81
83
|
attributes[:autocomplete] = "off"
|
82
84
|
else
|
83
85
|
# Handle any unrecognized input types
|
84
|
-
|
86
|
+
Rails.logger.warn("Unhandled input type: #{attributes[:type].inspect}")
|
87
|
+
attributes[:type] = :text
|
85
88
|
end
|
86
89
|
|
87
90
|
if (attributes[:type] == :file) ? attributes[:multiple] : attributes.delete(:multiple)
|
@@ -18,8 +18,8 @@ module Phlexi
|
|
18
18
|
def calculate_max
|
19
19
|
if (numericality_validator = find_numericality_validator)
|
20
20
|
get_max_from_validator(numericality_validator)
|
21
|
-
|
22
|
-
|
21
|
+
else
|
22
|
+
get_max_from_attribute(key)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -44,8 +44,8 @@ module Phlexi
|
|
44
44
|
if object.class.respond_to?(:attribute_types) && (attribute_type = object.class.attribute_types[attribute.to_s])
|
45
45
|
if (range = attribute_type.instance_variable_get(:@range))
|
46
46
|
range.max
|
47
|
-
|
48
|
-
(precision**8) - ((step && step != "any") ? step : 0.000001)
|
47
|
+
# elsif attribute_type.respond_to?(:precision) && (precision = attribute_type.precision)
|
48
|
+
# (precision**8) - ((step && step != "any") ? step : 0.000001)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -18,8 +18,8 @@ module Phlexi
|
|
18
18
|
def calculate_min
|
19
19
|
if (numericality_validator = find_numericality_validator)
|
20
20
|
get_min_from_validator(numericality_validator)
|
21
|
-
|
22
|
-
|
21
|
+
else
|
22
|
+
get_min_from_attribute(key)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -44,8 +44,8 @@ module Phlexi
|
|
44
44
|
if object.class.respond_to?(:attribute_types) && (attribute_type = object.class.attribute_types[attribute.to_s])
|
45
45
|
if (range = attribute_type.instance_variable_get(:@range))
|
46
46
|
range.min
|
47
|
-
|
48
|
-
-((precision**8) - ((step && step != "any") ? step : 0.000001))
|
47
|
+
# elsif attribute_type.respond_to?(:precision) && (precision = attribute_type.precision)
|
48
|
+
# -((precision**8) - ((step && step != "any") ? step : 0.000001))
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/phlexi/form/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlexi-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|