rails_bootstrap_form 0.5.3 → 0.6.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/rails_bootstrap_form.css +3 -0
- data/demo/app/views/users/_form.html.erb +2 -0
- data/demo/app/views/users/_horizontal_form.html.erb +32 -0
- data/demo/app/views/users/_vertical_form.html.erb +2 -2
- data/lib/rails_bootstrap_form/bootstrap_form_options.rb +21 -3
- data/lib/rails_bootstrap_form/components/check_box.rb +11 -2
- data/lib/rails_bootstrap_form/components/labels.rb +7 -1
- data/lib/rails_bootstrap_form/components/radio_button.rb +11 -2
- data/lib/rails_bootstrap_form/field_wrapper_builder.rb +31 -17
- data/lib/rails_bootstrap_form/helpers.rb +30 -0
- data/lib/rails_bootstrap_form/inputs.rb +35 -14
- data/lib/rails_bootstrap_form/version.rb +1 -1
- data/lib/rails_bootstrap_form.rb +1 -0
- metadata +4 -3
- data/lib/rails_bootstrap_form/inputs/base.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa73fbc58e6dd0b2dc4b823cd6732de17b0e84e52d9177bce4684b61609238e0
|
4
|
+
data.tar.gz: f190515751e2cbc2bf51c195c8aa0ac7e2459ae040f1ba8dd544532f6887a514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f41528a442151162803ec730b18fde0d10cd002446e5a402c037acb4aea7933e5749a5f5d3824762a83fc41a5fc2d87ecedafc7371755c45cdeafcb783f13a7f
|
7
|
+
data.tar.gz: 139a3f9bd52be5936676ddc8b730a9a211f715f32b8ca8ba12ad6d045233ed9836e90317bf33a43ab07e27ac52c0ae77e5c9c290e9157e75def6b07341a96a30
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="card card-primary my-3">
|
2
|
+
<div class="card-header fw-bold">
|
3
|
+
Profile Form (Horizontal layout)
|
4
|
+
</div>
|
5
|
+
<div class="card-body">
|
6
|
+
<%= bootstrap_form_for @user, bootstrap_form: {layout: :horizontal} do |form| %>
|
7
|
+
<%= form.text_field :name, autocomplete: "new-name" %>
|
8
|
+
<%= form.text_field :email, autocomplete: "new-email" %>
|
9
|
+
<%= form.text_field :password, autocomplete: "new-password" %>
|
10
|
+
<%= form.phone_field :mobile_number %>
|
11
|
+
<%= form.date_field :birth_date %>
|
12
|
+
<%= form.radio_button :terms, 1, required: true %>
|
13
|
+
<%= form.range_field :excellence %>
|
14
|
+
<%= form.url_field :blog_url %>
|
15
|
+
<%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {bootstrap_form: {}, checked: form.object.fruit_id} %>
|
16
|
+
<%= form.color_field :favorite_color %>
|
17
|
+
<%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name, {bootstrap_form: {}} %>
|
18
|
+
<%= form.fields_for :address, include_id: false, bootstrap_form: {layout: :horizontal} do |address_form| %>
|
19
|
+
<%= address_form.text_area :street %>
|
20
|
+
<%= address_form.text_field :state %>
|
21
|
+
<%= address_form.grouped_collection_select :city, ::Country.includes(:cities), :cities, :name, :id, :name, {include_blank: "Select city"} %>
|
22
|
+
<%= address_form.text_field :postal_code %>
|
23
|
+
<%= address_form.select :country_id, options_for_select(::Country.pluck(:name, :id), address_form.object.country_id),
|
24
|
+
{include_blank: "Select Country", bootstrap_form: {}} %>
|
25
|
+
<% end %>
|
26
|
+
<div class="mt-3">
|
27
|
+
<%= form.submit "Register", class: "btn btn-primary" %>
|
28
|
+
<%= link_to "Cancel", users_path, class: "btn btn-secondary" %>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
@@ -12,9 +12,9 @@
|
|
12
12
|
<%= form.check_box :terms, bootstrap_form: {switch: false}, required: true %>
|
13
13
|
<%= form.range_field :excellence %>
|
14
14
|
<%= form.url_field :blog_url %>
|
15
|
-
<%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {bootstrap_form: {
|
15
|
+
<%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {bootstrap_form: {}, checked: form.object.fruit_id} %>
|
16
16
|
<%= form.color_field :favorite_color %>
|
17
|
-
<%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name, {bootstrap_form: {
|
17
|
+
<%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name, {bootstrap_form: {}} %>
|
18
18
|
<%= form.fields_for :address, include_id: false do |address_form| %>
|
19
19
|
<%= address_form.text_area :street %>
|
20
20
|
<%= address_form.text_field :state %>
|
@@ -50,8 +50,9 @@ module RailsBootstrapForm
|
|
50
50
|
# readers. Default is `visually-hidden`
|
51
51
|
attr_accessor :hide_class
|
52
52
|
|
53
|
-
# Default CSS class that will be applied to all label tags
|
54
|
-
#
|
53
|
+
# Default CSS class that will be applied to all label tags when layout is
|
54
|
+
# vertical.
|
55
|
+
# The default value is `form-label`.
|
55
56
|
attr_accessor :label_class
|
56
57
|
|
57
58
|
# An additional CSS class that will be added along with the existing
|
@@ -105,6 +106,19 @@ module RailsBootstrapForm
|
|
105
106
|
# form.collection_radio_buttons :choices, ["yes", "no"], :to_s, :to_s, bootstrap_form: {inline: true}
|
106
107
|
attr_accessor :inline
|
107
108
|
|
109
|
+
# Default CSS class that will be applied to all label tags when layout is
|
110
|
+
# horizontal.
|
111
|
+
# The default value is `col-form-label`.
|
112
|
+
attr_accessor :label_col_class
|
113
|
+
|
114
|
+
# Default CSS class for label column when using horizontal form.
|
115
|
+
# The default value is `col-sm-2`.
|
116
|
+
attr_accessor :label_col_wrapper_class
|
117
|
+
|
118
|
+
# Default CSS class for control column when using horizontal form.
|
119
|
+
# The default value is `col-sm-10`.
|
120
|
+
attr_accessor :field_col_wrapper_class
|
121
|
+
|
108
122
|
def initialize(options = {})
|
109
123
|
set_defaults
|
110
124
|
set_bootstrap_form_options(options)
|
@@ -131,7 +145,7 @@ module RailsBootstrapForm
|
|
131
145
|
# to a given form field. For example, we can change grid just for one field:
|
132
146
|
#
|
133
147
|
# bootstrap_form_with model: @user do |f|
|
134
|
-
# f.text_field :email, bootstrap_form: {
|
148
|
+
# f.text_field :email, bootstrap_form: {label_col_wrapper_class: "col-md-6", field_col_wrapper_class: "col-md-6"}
|
135
149
|
# f.password_field :password
|
136
150
|
# end
|
137
151
|
#
|
@@ -173,6 +187,10 @@ module RailsBootstrapForm
|
|
173
187
|
@size = nil
|
174
188
|
|
175
189
|
@inline = false
|
190
|
+
|
191
|
+
@label_col_class = "col-form-label"
|
192
|
+
@label_col_wrapper_class = "col-sm-2"
|
193
|
+
@field_col_wrapper_class = "col-sm-10"
|
176
194
|
end
|
177
195
|
|
178
196
|
private :set_defaults
|
@@ -7,6 +7,8 @@ module RailsBootstrapForm
|
|
7
7
|
module CheckBox
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
|
+
include RailsBootstrapForm::Helpers
|
11
|
+
|
10
12
|
def self.included(base_class)
|
11
13
|
def check_box_label(attribute, checked_value, options, bootstrap_options, &block)
|
12
14
|
unless bootstrap_options.skip_label
|
@@ -62,11 +64,18 @@ module RailsBootstrapForm
|
|
62
64
|
classes = Array("form-check")
|
63
65
|
classes << "form-switch" if bootstrap_options.switch
|
64
66
|
classes << "form-check-inline" if bootstrap_options.inline?
|
65
|
-
classes << "mb-3"
|
67
|
+
classes << "mb-3" unless (bootstrap_options.layout_horizontal? || bootstrap_options.inline?)
|
68
|
+
classes.flatten.compact
|
69
|
+
end
|
70
|
+
|
71
|
+
def check_box_container_classes(bootstrap_options)
|
72
|
+
classes = Array(bootstrap_options.field_col_wrapper_class)
|
73
|
+
classes << field_offset_class(bootstrap_options.label_col_wrapper_class)
|
66
74
|
classes.flatten.compact
|
67
75
|
end
|
68
76
|
|
69
|
-
private :check_box_label, :check_box_classes, :check_box_label_class,
|
77
|
+
private :check_box_label, :check_box_classes, :check_box_label_class,
|
78
|
+
:check_box_wrapper_class, :check_box_container_classes
|
70
79
|
end
|
71
80
|
end
|
72
81
|
end
|
@@ -21,7 +21,13 @@ module RailsBootstrapForm
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def label_classes(attribute, bootstrap_options)
|
24
|
-
classes = [
|
24
|
+
classes = []
|
25
|
+
classes << if bootstrap_options.layout_horizontal?
|
26
|
+
[bootstrap_options.label_col_class, bootstrap_options.label_col_wrapper_class]
|
27
|
+
else
|
28
|
+
bootstrap_options.label_class
|
29
|
+
end
|
30
|
+
classes << bootstrap_options.additional_label_class
|
25
31
|
classes << bootstrap_options.hide_class if bootstrap_options.hide_label
|
26
32
|
classes << "required" if is_attribute_required?(attribute)
|
27
33
|
classes << "is-invalid" if is_invalid?(attribute)
|
@@ -7,6 +7,8 @@ module RailsBootstrapForm
|
|
7
7
|
module RadioButton
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
|
+
include RailsBootstrapForm::Helpers
|
11
|
+
|
10
12
|
def self.included(base_class)
|
11
13
|
def radio_button_label(attribute, value, options, bootstrap_options)
|
12
14
|
unless bootstrap_options.skip_label
|
@@ -58,11 +60,18 @@ module RailsBootstrapForm
|
|
58
60
|
def radio_button_wrapper_class(bootstrap_options)
|
59
61
|
classes = Array("form-check")
|
60
62
|
classes << "form-check-inline" if bootstrap_options.inline?
|
61
|
-
classes << "mb-3"
|
63
|
+
classes << "mb-3" unless (bootstrap_options.layout_horizontal? || bootstrap_options.inline?)
|
64
|
+
classes.flatten.compact
|
65
|
+
end
|
66
|
+
|
67
|
+
def radio_button_container_classes(bootstrap_options)
|
68
|
+
classes = Array(bootstrap_options.field_col_wrapper_class)
|
69
|
+
classes << field_offset_class(bootstrap_options.label_col_wrapper_class)
|
62
70
|
classes.flatten.compact
|
63
71
|
end
|
64
72
|
|
65
|
-
private :radio_button_label, :radio_button_classes, :radio_button_label_class,
|
73
|
+
private :radio_button_label, :radio_button_classes, :radio_button_label_class,
|
74
|
+
:radio_button_wrapper_class, :radio_button_container_classes
|
66
75
|
end
|
67
76
|
end
|
68
77
|
end
|
@@ -16,35 +16,49 @@ module RailsBootstrapForm
|
|
16
16
|
label = draw_label(attribute, options, bootstrap_options)
|
17
17
|
help_text = help_text(attribute, bootstrap_options)
|
18
18
|
|
19
|
-
if bootstrap_options.
|
19
|
+
if bootstrap_options.layout_horizontal?
|
20
20
|
tag.div(**field_wrapper_options(bootstrap_options)) do
|
21
|
-
concat(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
concat(label)
|
22
|
+
concat(tag.div(class: bootstrap_options.field_col_wrapper_class) do
|
23
|
+
concat(input_group_wrapper(attribute, bootstrap_options) do
|
24
|
+
capture(&block)
|
25
|
+
end)
|
26
|
+
concat(help_text)
|
26
27
|
end)
|
27
|
-
concat(help_text)
|
28
28
|
end
|
29
29
|
else
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
if bootstrap_options.floating
|
31
|
+
tag.div(**field_wrapper_options(bootstrap_options)) do
|
32
|
+
concat(input_group_wrapper(attribute, bootstrap_options) do
|
33
|
+
tag.div(class: floating_label_classes(attribute)) do
|
34
|
+
concat(capture(&block))
|
35
|
+
concat(label)
|
36
|
+
end
|
37
|
+
end)
|
38
|
+
concat(help_text)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
tag.div(**field_wrapper_options(bootstrap_options)) do
|
42
|
+
concat(label)
|
43
|
+
concat(input_group_wrapper(attribute, bootstrap_options) do
|
44
|
+
capture(&block)
|
45
|
+
end)
|
46
|
+
concat(help_text)
|
47
|
+
end
|
36
48
|
end
|
37
49
|
end
|
38
50
|
end
|
39
51
|
|
40
52
|
def field_wrapper_options(bootstrap_options)
|
41
53
|
{}.tap do |option|
|
42
|
-
option[:class] = field_wrapper_classes
|
54
|
+
option[:class] = field_wrapper_classes(bootstrap_options)
|
43
55
|
end.merge(bootstrap_options.wrapper_options)
|
44
56
|
end
|
45
57
|
|
46
|
-
def field_wrapper_classes
|
47
|
-
classes = [
|
58
|
+
def field_wrapper_classes(bootstrap_options)
|
59
|
+
classes = []
|
60
|
+
classes << "row" if bootstrap_options.layout_horizontal?
|
61
|
+
classes << form_wrapper_default_class
|
48
62
|
classes.flatten.compact
|
49
63
|
end
|
50
64
|
|
@@ -68,7 +82,7 @@ module RailsBootstrapForm
|
|
68
82
|
css_options[:class] = field_classes.flatten.compact
|
69
83
|
css_options.merge!(required_field_options(attribute, options))
|
70
84
|
|
71
|
-
if bootstrap_options.floating
|
85
|
+
if (bootstrap_options.floating && !bootstrap_options.layout_horizontal?)
|
72
86
|
css_options[:placeholder] ||= label_text(attribute, bootstrap_options)
|
73
87
|
end
|
74
88
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
module RailsBootstrapForm
|
6
|
+
module Helpers
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def self.included(base_class)
|
10
|
+
def collection_input_checked?(checked, obj, input_value)
|
11
|
+
checked == input_value || Array(checked).try(:include?, input_value) ||
|
12
|
+
checked == obj || Array(checked).try(:include?, obj)
|
13
|
+
end
|
14
|
+
|
15
|
+
def control_specific_class(field_tag_name)
|
16
|
+
"rails-bootstrap-forms-#{field_tag_name.to_s.tr("_", "-")}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_size_valid?(bootstrap_options)
|
20
|
+
bootstrap_options.size && %i(sm lg).include?(bootstrap_options.size)
|
21
|
+
end
|
22
|
+
|
23
|
+
def field_offset_class(label_col_wrapper_class)
|
24
|
+
label_col_wrapper_class.gsub(/\bcol-(\w+)-(\d)\b/, 'offset-\1-\2')
|
25
|
+
end
|
26
|
+
|
27
|
+
private :collection_input_checked?, :control_specific_class, :is_size_valid?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -3,14 +3,9 @@
|
|
3
3
|
# -*- warn_indent: true -*-
|
4
4
|
|
5
5
|
module RailsBootstrapForm
|
6
|
-
|
7
|
-
|
8
|
-
extend ActiveSupport::Autoload
|
9
|
-
|
10
|
-
autoload :Base
|
11
|
-
|
12
|
-
include Base
|
6
|
+
include Helpers
|
13
7
|
|
8
|
+
module Inputs
|
14
9
|
FIELD_HELPERS = %i[
|
15
10
|
text_field
|
16
11
|
url_field
|
@@ -141,10 +136,22 @@ module RailsBootstrapForm
|
|
141
136
|
concat(check_box_field)
|
142
137
|
concat(check_box_label)
|
143
138
|
concat(check_box_help_text) unless bootstrap_options.inline?
|
144
|
-
concat(generate_error(attribute)) if is_invalid?(attribute) && !bootstrap_options.inline?
|
139
|
+
concat(generate_error(attribute)) if (is_invalid?(attribute) && !bootstrap_options.inline?)
|
145
140
|
end
|
146
141
|
|
147
|
-
|
142
|
+
if bootstrap_options.inline?
|
143
|
+
check_box_html
|
144
|
+
else
|
145
|
+
if bootstrap_options.layout_horizontal?
|
146
|
+
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
147
|
+
tag.div(class: check_box_container_classes(bootstrap_options)) do
|
148
|
+
check_box_html
|
149
|
+
end
|
150
|
+
end
|
151
|
+
else
|
152
|
+
check_box_html
|
153
|
+
end
|
154
|
+
end
|
148
155
|
end
|
149
156
|
|
150
157
|
def radio_button(attribute, value, options = {})
|
@@ -161,10 +168,22 @@ module RailsBootstrapForm
|
|
161
168
|
concat(radio_button_field)
|
162
169
|
concat(radio_button_label)
|
163
170
|
concat(radio_button_help_text) unless bootstrap_options.inline?
|
164
|
-
concat(generate_error(attribute)) if is_invalid?(attribute) && !bootstrap_options.inline?
|
171
|
+
concat(generate_error(attribute)) if (is_invalid?(attribute) && !bootstrap_options.inline?)
|
165
172
|
end
|
166
173
|
|
167
|
-
|
174
|
+
if bootstrap_options.inline?
|
175
|
+
radio_button_html
|
176
|
+
else
|
177
|
+
if bootstrap_options.layout_horizontal?
|
178
|
+
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
179
|
+
tag.div(class: radio_button_container_classes(bootstrap_options)) do
|
180
|
+
radio_button_html
|
181
|
+
end
|
182
|
+
end
|
183
|
+
else
|
184
|
+
radio_button_html
|
185
|
+
end
|
186
|
+
end
|
168
187
|
end
|
169
188
|
|
170
189
|
def collection_check_boxes(attribute, collection, value_method, text_method, options = {}, html_options = {}, &block)
|
@@ -176,7 +195,8 @@ module RailsBootstrapForm
|
|
176
195
|
input_value = value_method.respond_to?(:call) ? value_method.call(object) : object.send(value_method)
|
177
196
|
input_options = {
|
178
197
|
bootstrap_form: {
|
179
|
-
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method)
|
198
|
+
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method),
|
199
|
+
inline: true
|
180
200
|
}
|
181
201
|
}.deep_merge!(options)
|
182
202
|
|
@@ -184,7 +204,7 @@ module RailsBootstrapForm
|
|
184
204
|
end
|
185
205
|
|
186
206
|
if options.delete(:include_hidden) { true }
|
187
|
-
inputs.prepend
|
207
|
+
inputs.prepend(hidden_field(attribute, value: "", multiple: options[:multiple]))
|
188
208
|
end
|
189
209
|
|
190
210
|
field_wrapper_builder(attribute, options, html_options) do
|
@@ -201,7 +221,8 @@ module RailsBootstrapForm
|
|
201
221
|
input_value = value_method.respond_to?(:call) ? value_method.call(object) : object.send(value_method)
|
202
222
|
input_options = {
|
203
223
|
bootstrap_form: {
|
204
|
-
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method)
|
224
|
+
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method),
|
225
|
+
inline: true
|
205
226
|
}
|
206
227
|
}.deep_merge!(options)
|
207
228
|
|
data/lib/rails_bootstrap_form.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_bootstrap_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harshal LADHE (shivam091)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: generator_spec
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- demo/app/views/layouts/application.html.erb
|
66
66
|
- demo/app/views/users/_form.html.erb
|
67
67
|
- demo/app/views/users/_form_without_bootstrap_helpers.html.erb
|
68
|
+
- demo/app/views/users/_horizontal_form.html.erb
|
68
69
|
- demo/app/views/users/_vertical_form.html.erb
|
69
70
|
- demo/app/views/users/edit.html.erb
|
70
71
|
- demo/app/views/users/index.html.erb
|
@@ -120,9 +121,9 @@ files:
|
|
120
121
|
- lib/rails_bootstrap_form/configuration.rb
|
121
122
|
- lib/rails_bootstrap_form/engine.rb
|
122
123
|
- lib/rails_bootstrap_form/field_wrapper_builder.rb
|
124
|
+
- lib/rails_bootstrap_form/helpers.rb
|
123
125
|
- lib/rails_bootstrap_form/input_group_builder.rb
|
124
126
|
- lib/rails_bootstrap_form/inputs.rb
|
125
|
-
- lib/rails_bootstrap_form/inputs/base.rb
|
126
127
|
- lib/rails_bootstrap_form/version.rb
|
127
128
|
- sig/rails_bootstrap_form.rbs
|
128
129
|
homepage: https://github.com/shivam091/rails_bootstrap_form
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
# -*- frozen_string_literal: true -*-
|
3
|
-
# -*- warn_indent: true -*-
|
4
|
-
|
5
|
-
module RailsBootstrapForm
|
6
|
-
module Inputs
|
7
|
-
module Base
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
def self.included(base_class)
|
11
|
-
def collection_input_checked?(checked, obj, input_value)
|
12
|
-
checked == input_value || Array(checked).try(:include?, input_value) ||
|
13
|
-
checked == obj || Array(checked).try(:include?, obj)
|
14
|
-
end
|
15
|
-
|
16
|
-
def control_specific_class(field_tag_name)
|
17
|
-
"rails-bootstrap-forms-#{field_tag_name.to_s.tr("_", "-")}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def is_size_valid?(bootstrap_options)
|
21
|
-
bootstrap_options.size && %i(sm lg).include?(bootstrap_options.size)
|
22
|
-
end
|
23
|
-
|
24
|
-
private :collection_input_checked?, :control_specific_class, :is_size_valid?
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|