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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f33d8a7c5b5a17656dc325d688c903ccfdc7780ef400340b9980dfd2a341d164
|
4
|
+
data.tar.gz: eff2f3c9613d598feca7192fbc973452a544215840e92e662f30e3e4462922ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ef75e441c851217ba6ba93a69f693547cac3726b4481b8a400c7a93653e1831aef21e9e6f6c18581809c3c402e9fc560b416a9949ebd44c36251b72c7b73771
|
7
|
+
data.tar.gz: 4d73c166848a01b13bff4be90b41dfd6269e9a58d53765068451884a96d50aabee903109680ee7453659baf95163558918d249004801560299006bdc7af6f40b
|
data/Gemfile.lock
CHANGED
@@ -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
|
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
|
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
|
-
|
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
|
}
|