phlexi-form 0.5.2 → 0.5.4

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: e6b1a5926f08261bf0fa3c607395ddd570c52417636f559b7f11a87a46e8c06d
4
- data.tar.gz: ca036dc0035a0161fe4a0411dddbff11d7b1edea529b266ac3b29b1caded91e5
3
+ metadata.gz: 6c0832db88c6c818befeb3eb29ab0c27cfd6283c6bb76356fe100d7b90cc4471
4
+ data.tar.gz: 1567a41dbfb954ab71c4f47625955d95253c0af56340fa250a6e82fb651f26ef
5
5
  SHA512:
6
- metadata.gz: 94a54baa5507d3309efbf06dc8aa230ec8814be37fe7a99e72b294c9d3ed0528e90ea5f782b1333179a5fef8b3b244355b22f38b8bd4d98a661d40440adc52ad
7
- data.tar.gz: bea9112fe8131a517381b1a2d4715b266b09fe82a608e96495366e43d4a565ae0bd60296e455118ad515ea41d795e49218a917367dcd3c7478fc88d2ce0cd1da
6
+ metadata.gz: 32645119292a9042dba8e9f8593377d8f75e58f02d423c47188331d43d695a6f950060aab0ed9b458bd6638c8b9d72b215e83d9ffc657ddbadb2f78d61bc8e71
7
+ data.tar.gz: 8dc3b74c1d8c856c7b06599bb82e0d15a1649aec515ec855533073e3c86ea8ace4c177220b35f0be1d60c558a400c403d8bbddcb6debde7c5f01d4966ad18774
@@ -256,16 +256,13 @@ module Phlexi
256
256
  protected
257
257
 
258
258
  def create_component(component_class, theme_key, **attributes, &)
259
- theme_attributes = apply_component_theme(attributes, theme_key)
259
+ attributes = apply_component_theme(attributes, theme_key)
260
260
  # TODO: refactor all this type checking code such that, the concerns will perform these actions.
261
261
  # Basically, invert control so that the component asks for the extra attributes
262
262
  # or calls #has_file_input!
263
- extra_attributes = if component_class.include?(Phlexi::Form::Components::Concerns::HandlesInput)
264
- input_attributes
265
- else
266
- {}
263
+ if component_class.include?(Phlexi::Form::Components::Concerns::HandlesInput)
264
+ attributes = mix(input_attributes, attributes)
267
265
  end
268
- attributes = mix(theme_attributes, extra_attributes, attributes)
269
266
  component = component_class.new(self, **attributes, &)
270
267
  if component_class.include?(Components::Concerns::ExtractsInput)
271
268
  raise "input component already defined: #{@field_input_extractor.inspect}" if @field_input_extractor
@@ -278,10 +275,10 @@ module Phlexi
278
275
  end
279
276
 
280
277
  def apply_component_theme(attributes, theme_key)
281
- return {} if attributes.key?(:class!)
278
+ return attributes if attributes.key?(:class!)
282
279
 
283
280
  theme_key = attributes.delete(:theme) || theme_key
284
- {class: themed(theme_key, self)}
281
+ mix({class: themed(theme_key, self)}, attributes)
285
282
  end
286
283
 
287
284
  def determine_initial_value(value)
@@ -7,7 +7,7 @@ module Phlexi
7
7
  private
8
8
 
9
9
  def infer_field_component
10
- return :select if choices
10
+ return :select if inferred_field_type != :association && choices
11
11
 
12
12
  case inferred_field_type
13
13
  when :string, :text
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Form
5
- VERSION = "0.5.2"
5
+ VERSION = "0.5.4"
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.2
4
+ version: 0.5.4
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-10-28 00:00:00.000000000 Z
11
+ date: 2024-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex