phlexi-form 0.5.5 → 0.5.7

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: 8583b90522a61700dac8266304e8777df43ea499e53cd449acd70fd68c32d55a
4
- data.tar.gz: 5e9304c0e8be9e7770ddba399e63fb260c5038f0f7bda28fbd6a32b226e0ce12
3
+ metadata.gz: caffd32f45047afeefc49aa53617c040aa58bcc2feb2c08ccf557343e23e2cd2
4
+ data.tar.gz: 30322935ea64a0c9d101713fbf0eeee5b58df1c23bf5df5fac8410fc8e4fffd6
5
5
  SHA512:
6
- metadata.gz: fcf54a8f4b08e5bbed3973aaebcc2c95cb0d976a0946daf10e7d3ddd4eb338274ea3b6200e6548be68df597fe647fdc2e344f80a663b2e6246c3ff4c64eec03e
7
- data.tar.gz: 6741eeefed087421ee96c7b962606a8331800c2649c4447d62cb2bf1f39de28a9194aace3022a31ee661292f482b81075909ed96f29ced1422bb45a03ad9a4d8
6
+ metadata.gz: 3944387335922b711ad776f331db795c99cf6dc166d32e90ec8199c5d56212581c58f4fca31dff9d6693b2df0debbed62cc53348f0c9305dc6fd463fea35c44d
7
+ data.tar.gz: c4b1e473bd8b3477d000aab90179df679f182dd557d81f7ff2c2613f8ad34ce1efd994365751741ab8f7f91e0a5c6c424afb025c07c2d1085b8f5fc24a3dc94c
@@ -105,11 +105,11 @@ module Phlexi
105
105
  yield if block_given?
106
106
  end
107
107
 
108
- def extract_input(params)
108
+ def extract_input(params, view_context: nil)
109
109
  params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
110
110
  params = {} unless params.is_a?(Hash)
111
111
 
112
- call unless @_rendered
112
+ call(view_context: view_context) unless @_rendered
113
113
  @namespace.extract_input(params)
114
114
  end
115
115
 
@@ -268,7 +268,7 @@ module Phlexi
268
268
  attributes = mix(input_attributes, attributes)
269
269
  end
270
270
  component = component_class.new(self, **attributes, &)
271
- if component_class.include?(Components::Concerns::ExtractsInput)
271
+ if component_class.include?(Components::Concerns::ExtractsInput)
272
272
  raise "input component already defined: #{@field_input_extractor.inspect}" if @field_input_extractor
273
273
 
274
274
  @field_input_extractor = component
@@ -15,7 +15,7 @@ module Phlexi
15
15
  p(class: themed(:form_errors_message, nil)) { @message }
16
16
  ul(class: themed(:form_errors_list, nil)) do
17
17
  @errors.each do |error|
18
- li(class: themed(:form_errors_list_item, nil)) {
18
+ li(class: themed(:form_errors_list_item, nil)) {
19
19
  error.to_s
20
20
  }
21
21
  end
@@ -8,7 +8,7 @@ module Phlexi
8
8
 
9
9
  def infer_field_component
10
10
  return :select if inferred_field_type != :association && choices
11
-
11
+
12
12
  case inferred_field_type
13
13
  when :string, :text
14
14
  infer_string_field_type || inferred_field_type
@@ -6,7 +6,7 @@ module Phlexi
6
6
  module ManagesFields
7
7
  def has_file_input!
8
8
  if parent
9
- parent.has_file_input!
9
+ parent.has_file_input!
10
10
  else
11
11
  @has_file_input = true
12
12
  end
@@ -14,7 +14,7 @@ module Phlexi
14
14
 
15
15
  def has_file_input?
16
16
  if parent
17
- parent.has_file_input?
17
+ parent.has_file_input?
18
18
  else
19
19
  @has_file_input || false
20
20
  end
@@ -5,7 +5,7 @@ module Phlexi
5
5
  module Structure
6
6
  class Namespace < Phlexi::Field::Structure::Namespace
7
7
  include Phlexi::Form::Structure::ManagesFields
8
-
8
+
9
9
  class NamespaceCollection < Phlexi::Form::Structure::NamespaceCollection; end
10
10
 
11
11
  def submit_button(key = :submit_button, **, &)
@@ -5,12 +5,17 @@ module Phlexi
5
5
  module Structure
6
6
  class NamespaceCollection < Phlexi::Field::Structure::NamespaceCollection
7
7
  include Phlexi::Form::Structure::ManagesFields
8
-
8
+
9
9
  def extract_input(params)
10
- namespace = build_namespace(0)
11
- @block.call(namespace)
10
+ namespace = namespaces[0]
11
+ unless namespace
12
+ build_namespace(0)
13
+ @block.call(namespace)
14
+ end
12
15
 
13
- inputs = params[key].map { |param| namespace.extract_input([param]) }
16
+ params = params[key]
17
+ params = params.values if params.is_a?(Hash)
18
+ inputs = params.map { |param| namespace.extract_input([param]) }
14
19
  {key => inputs}
15
20
  end
16
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Form
5
- VERSION = "0.5.5"
5
+ VERSION = "0.5.7"
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.5
4
+ version: 0.5.7
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-03 00:00:00.000000000 Z
11
+ date: 2024-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex