phlexi-form 0.5.9 → 0.5.11

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: cd38319ce7c06a99fbb83261e0fa96821e6049f6b93cc5848f1da7695b8e4ea9
4
- data.tar.gz: f593681253aa19b99d0ad0a65f0ae578cb21367616174bf5586bdfc2d5eafb82
3
+ metadata.gz: a90eefb63575ca59ebab859b3d025e4894b694553f0875848238f25c6d39d01e
4
+ data.tar.gz: 3f972bace2dd06428f6ec851828ceb61230332e34506c0852281182709581532
5
5
  SHA512:
6
- metadata.gz: da2017464ce01777a247523817fc9be624fb103aa4e718d0982c66ee14f70cd4e4c92b0ff0a691f265376f460783e545f98885f1518be2f91914fe52b8c2e1b6
7
- data.tar.gz: 9e36f93601d8c36034892e5dccb3e150fd7e5495519c2da441bb0921ede249421d7ae2649113da78e760fabe26ed22bb53186f1986570be4d8401cc4b6bfb90d
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
- # Rails.logger.warn("Unhandled input type: #{attributes[:type]}")
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
- elsif (max = get_max_from_attribute(key))
22
- max
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
- elsif attribute_type.respond_to?(:precision) && (precision = attribute_type.precision)
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
- elsif (min = get_min_from_attribute(key))
22
- min
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
- elsif attribute_type.respond_to?(:precision) && (precision = attribute_type.precision)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Form
5
- VERSION = "0.5.9"
5
+ VERSION = "0.5.11"
6
6
  end
7
7
  end
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.9
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-18 00:00:00.000000000 Z
11
+ date: 2024-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex