rails_bootstrap_form 0.6.1 → 0.6.2

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: 34303679b08cf0617516305e5b4e1f21d8c201ffcd9f4cc8eb90f26a587a7f7a
4
- data.tar.gz: 4e01e2321eb0318e222e802ce84e8c63648296c50e78de5de9f3c8e14be9570e
3
+ metadata.gz: f33d8a7c5b5a17656dc325d688c903ccfdc7780ef400340b9980dfd2a341d164
4
+ data.tar.gz: eff2f3c9613d598feca7192fbc973452a544215840e92e662f30e3e4462922ed
5
5
  SHA512:
6
- metadata.gz: c7f4349d0933eeea1f1965df83eb80ec0fd83392a3a47e2299214a797ec36e5c198e647d727969443779d60910741f91b49f88973a6ebcf6d93a29302f308b46
7
- data.tar.gz: adab966d0ca4b8064094e7e941296d95e75e594452384e9cb6e7370ca19fd288a4e9d9cea1e56dbf7981804ef58f9cafc1398d1e0203bb1eefb80004f27ab18d
6
+ metadata.gz: 7ef75e441c851217ba6ba93a69f693547cac3726b4481b8a400c7a93653e1831aef21e9e6f6c18581809c3c402e9fc560b416a9949ebd44c36251b72c7b73771
7
+ data.tar.gz: 4d73c166848a01b13bff4be90b41dfd6269e9a58d53765068451884a96d50aabee903109680ee7453659baf95163558918d249004801560299006bdc7af6f40b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_bootstrap_form (0.6.1)
4
+ rails_bootstrap_form (0.6.2)
5
5
  actionpack (~> 7.0)
6
6
  activemodel (~> 7.0)
7
7
 
@@ -14,7 +14,7 @@
14
14
  <%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {checked: form.object.fruit_id} %>
15
15
  <%= form.color_field :favorite_color %>
16
16
  <%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name %>
17
- <%= form.fields_for :address, include_id: false, bootstrap_form: {layout: :horizontal} do |address_form| %>
17
+ <%= form.fields_for :address, include_id: false do |address_form| %>
18
18
  <%= address_form.text_area :street %>
19
19
  <%= address_form.text_field :state %>
20
20
  <%= address_form.grouped_collection_select :city, ::Country.includes(:cities), :cities, :name, :id, :name, {include_blank: "Select city"} %>
@@ -15,16 +15,28 @@ module RailsBootstrapForm
15
15
  attr_accessor :bootstrap_form_options
16
16
 
17
17
  def initialize(object_name, object, template, options)
18
- @bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options.delete(:bootstrap_form))
18
+ @bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options[:bootstrap_form])
19
19
  apply_default_form_options(options)
20
20
  super(object_name, object, template, options)
21
21
  end
22
22
 
23
+ def fields_for(record_name, record_object = nil, fields_options = {}, &block)
24
+ fields_options = fields_for_options(record_object, fields_options)
25
+ record_object = nil if record_object.is_a?(Hash) && record_object.extractable_options?
26
+ super(record_name, record_object, fields_options, &block)
27
+ end
28
+
23
29
  def apply_default_form_options(options)
24
30
  options[:html] ||= {}
25
31
  options[:html].reverse_merge!(RailsBootstrapForm.config.default_form_attributes)
26
32
  end
27
33
 
28
- private :apply_default_form_options
34
+ def fields_for_options(record_object, fields_options)
35
+ field_options = record_object if record_object.is_a?(Hash) && record_object.extractable_options?
36
+ field_options = {bootstrap_form: options[:bootstrap_form]}.deep_merge!(field_options)
37
+ field_options
38
+ end
39
+
40
+ private :apply_default_form_options, :fields_for_options
29
41
  end
30
42
  end
@@ -9,7 +9,7 @@ module RailsBootstrapForm
9
9
 
10
10
  def self.included(base_class)
11
11
  def draw_label(attribute, options, bootstrap_options)
12
- unless bootstrap_options.skip_label
12
+ unless bootstrap_options.skip_label && !bootstrap_options.floating
13
13
  label_options = {
14
14
  class: label_classes(attribute, bootstrap_options)
15
15
  }
@@ -3,6 +3,6 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module RailsBootstrapForm
6
- VERSION = "0.6.1".freeze
6
+ VERSION = "0.6.2".freeze
7
7
  REQUIRED_RAILS_VERSION = "~> 7.0".freeze
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harshal LADHE (shivam091)