rails_bootstrap_form 0.7.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +1745 -7
- data/demo/app/controllers/users_controller.rb +7 -0
- data/demo/app/models/user.rb +3 -0
- data/demo/app/views/users/_form.html.erb +10 -2
- data/demo/app/views/users/_horizontal_form.html.erb +4 -5
- data/demo/app/views/users/_inline_form.html.erb +13 -0
- data/demo/app/views/users/_vertical_form.html.erb +4 -5
- data/demo/config/locales/en.rb +9 -1
- data/demo/db/migrate/20230528041919_add_columns_in_users.rb +11 -0
- data/demo/db/schema.rb +8 -1
- data/lib/rails_bootstrap_form/bootstrap_form_builder.rb +10 -1
- data/lib/rails_bootstrap_form/bootstrap_form_options.rb +40 -37
- data/lib/rails_bootstrap_form/field_wrapper_builder.rb +8 -4
- data/lib/rails_bootstrap_form/helpers/buttons.rb +7 -1
- data/lib/rails_bootstrap_form/helpers/check_box.rb +3 -1
- data/lib/rails_bootstrap_form/helpers/labels.rb +18 -9
- data/lib/rails_bootstrap_form/helpers/radio_button.rb +3 -1
- data/lib/rails_bootstrap_form/inputs/base.rb +1 -1
- data/lib/rails_bootstrap_form/inputs/check_box.rb +2 -0
- data/lib/rails_bootstrap_form/inputs/collection_check_boxes.rb +1 -1
- data/lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb +1 -1
- data/lib/rails_bootstrap_form/inputs/radio_button.rb +2 -0
- data/lib/rails_bootstrap_form/version.rb +1 -1
- metadata +4 -2
@@ -53,6 +53,13 @@ class UsersController < ApplicationController
|
|
53
53
|
:blog_url,
|
54
54
|
:fruit_id,
|
55
55
|
:favorite_color,
|
56
|
+
:username,
|
57
|
+
:expected_ctc,
|
58
|
+
:interview_date,
|
59
|
+
:interview_time,
|
60
|
+
:interview_datetime,
|
61
|
+
:weekly_off,
|
62
|
+
:gender,
|
56
63
|
skill_ids: [],
|
57
64
|
address_attributes: [
|
58
65
|
:street,
|
data/demo/app/models/user.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
<%= render partial: "users/form_without_bootstrap_helpers" %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
|
5
|
+
<% if true %>
|
6
|
+
<%= render partial: "users/inline_form" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% if true %>
|
10
|
+
<%= render partial: "users/vertical_form" %>
|
11
|
+
<% end %>
|
6
12
|
|
7
|
-
|
13
|
+
<% if true %>
|
14
|
+
<%= render partial: "users/horizontal_form" %>
|
15
|
+
<% end %>
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<div class="card card-primary my-3">
|
2
2
|
<div class="card-header fw-bold">
|
3
|
-
|
3
|
+
Horizontal layout
|
4
4
|
</div>
|
5
5
|
<div class="card-body">
|
6
6
|
<%= bootstrap_form_for @user, bootstrap_form: {layout: :horizontal} do |form| %>
|
7
7
|
<%= form.text_field :name, autocomplete: "new-name" %>
|
8
|
+
<%= form.text_field :username, autocomplete: "new-username" %>
|
8
9
|
<%= form.email_field :email, autocomplete: "new-email" %>
|
9
10
|
<%= form.password_field :password, autocomplete: "new-password" %>
|
10
11
|
<%= form.phone_field :mobile_number %>
|
@@ -23,10 +24,8 @@
|
|
23
24
|
{include_blank: "Select Country"} %>
|
24
25
|
<% end %>
|
25
26
|
<%= form.check_box :terms, required: true %>
|
26
|
-
|
27
|
-
|
28
|
-
<%= link_to "Cancel", users_path, class: "btn btn-secondary" %>
|
29
|
-
</div>
|
27
|
+
<%= form.primary "Register" %>
|
28
|
+
<%= link_to "Cancel", users_path, class: "btn btn-secondary" %>
|
30
29
|
<% end %>
|
31
30
|
</div>
|
32
31
|
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="card card-primary my-3">
|
2
|
+
<div class="card-header fw-bold">
|
3
|
+
Inline layout
|
4
|
+
</div>
|
5
|
+
<div class="card-body">
|
6
|
+
<%= bootstrap_form_for @user, bootstrap_form: {layout: :inline} do |form| %>
|
7
|
+
<%= form.text_field :username, autocomplete: "new-username" %>
|
8
|
+
<%= form.password_field :password, autocomplete: "new-password" %>
|
9
|
+
<%= form.check_box :remember_me %>
|
10
|
+
<%= form.primary "Login" %>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<div class="card card-primary my-3">
|
2
2
|
<div class="card-header fw-bold">
|
3
|
-
|
3
|
+
Vertical layout
|
4
4
|
</div>
|
5
5
|
<div class="card-body">
|
6
6
|
<%= bootstrap_form_for @user do |form| %>
|
7
7
|
<%= form.text_field :name, autocomplete: "new-name" %>
|
8
|
+
<%= form.text_field :username, autocomplete: "new-username" %>
|
8
9
|
<%= form.email_field :email, autocomplete: "new-email" %>
|
9
10
|
<%= form.password_field :password, autocomplete: "new-password" %>
|
10
11
|
<%= form.phone_field :mobile_number %>
|
@@ -23,10 +24,8 @@
|
|
23
24
|
{include_blank: "Select Country"} %>
|
24
25
|
<% end %>
|
25
26
|
<%= form.check_box :terms, required: true %>
|
26
|
-
|
27
|
-
|
28
|
-
<%= link_to "Cancel", users_path, class: "btn btn-secondary" %>
|
29
|
-
</div>
|
27
|
+
<%= form.primary "Register" %>
|
28
|
+
<%= link_to "Cancel", users_path, class: "btn btn-secondary" %>
|
30
29
|
<% end %>
|
31
30
|
</div>
|
32
31
|
</div>
|
data/demo/config/locales/en.rb
CHANGED
@@ -27,6 +27,14 @@
|
|
27
27
|
terms: "I accept terms and conditions",
|
28
28
|
excellence: "Excellence",
|
29
29
|
skill_ids: "Skills",
|
30
|
+
username: "Username",
|
31
|
+
remember_me: "Keep me signed in",
|
32
|
+
expected_ctc: "Expected CTC",
|
33
|
+
interview_date: "Interview date",
|
34
|
+
interview_time: "Interview time",
|
35
|
+
interview_datetime: "Interview date & time",
|
36
|
+
weekly_off: "Week off",
|
37
|
+
gender: "Gender",
|
30
38
|
},
|
31
39
|
user_skill: {
|
32
40
|
user_id: "User",
|
@@ -45,7 +53,7 @@
|
|
45
53
|
email: "Please use official email address",
|
46
54
|
terms: "You must first accept terms and conditions in order to continue",
|
47
55
|
skill_ids: "Select your strong skills",
|
48
|
-
fruit_id: "Select your favorite fruit"
|
56
|
+
fruit_id: "Select your favorite fruit",
|
49
57
|
}
|
50
58
|
},
|
51
59
|
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddColumnsInUsers < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
add_column :users, :username, :string
|
4
|
+
add_column :users, :expected_ctc, :float
|
5
|
+
add_column :users, :interview_date, :date
|
6
|
+
add_column :users, :interview_time, :time
|
7
|
+
add_column :users, :interview_datetime, :datetime
|
8
|
+
add_column :users, :weekly_off, :string
|
9
|
+
add_column :users, :gender, :string
|
10
|
+
end
|
11
|
+
end
|
data/demo/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema[7.0].define(version:
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2023_05_28_041919) do
|
14
14
|
# These are extensions that must be enabled in order to support this database
|
15
15
|
enable_extension "plpgsql"
|
16
16
|
|
@@ -74,6 +74,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_16_044126) do
|
|
74
74
|
t.string "favorite_color"
|
75
75
|
t.datetime "created_at", null: false
|
76
76
|
t.datetime "updated_at", null: false
|
77
|
+
t.string "username"
|
78
|
+
t.float "expected_ctc"
|
79
|
+
t.date "interview_date"
|
80
|
+
t.time "interview_time"
|
81
|
+
t.datetime "interview_datetime"
|
82
|
+
t.string "weekly_off"
|
83
|
+
t.string "gender"
|
77
84
|
t.index ["fruit_id"], name: "index_users_on_fruit_id"
|
78
85
|
end
|
79
86
|
|
@@ -17,6 +17,7 @@ module RailsBootstrapForm
|
|
17
17
|
def initialize(object_name, object, template, options)
|
18
18
|
@bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options[:bootstrap_form])
|
19
19
|
apply_default_form_options(options)
|
20
|
+
apply_default_form_classes(options)
|
20
21
|
super(object_name, object, template, options)
|
21
22
|
end
|
22
23
|
|
@@ -31,12 +32,20 @@ module RailsBootstrapForm
|
|
31
32
|
options[:html].reverse_merge!(RailsBootstrapForm.config.default_form_attributes)
|
32
33
|
end
|
33
34
|
|
35
|
+
def apply_default_form_classes(options)
|
36
|
+
return unless @bootstrap_form_options.layout_inline?
|
37
|
+
|
38
|
+
options[:html][:class] =
|
39
|
+
([*options[:html][:class]&.split(/\s+/)] + %w[row row-cols-lg-auto g-3 align-items-center])
|
40
|
+
.compact.uniq.join(" ")
|
41
|
+
end
|
42
|
+
|
34
43
|
def fields_for_options(record_object, fields_options)
|
35
44
|
field_options = record_object if record_object.is_a?(Hash) && record_object.extractable_options?
|
36
45
|
field_options = {bootstrap_form: options[:bootstrap_form]}.deep_merge!(field_options)
|
37
46
|
field_options
|
38
47
|
end
|
39
48
|
|
40
|
-
private :apply_default_form_options, :fields_for_options
|
49
|
+
private :apply_default_form_options, :fields_for_options, :apply_default_form_classes
|
41
50
|
end
|
42
51
|
end
|
@@ -16,47 +16,47 @@ module RailsBootstrapForm
|
|
16
16
|
#
|
17
17
|
class BootstrapFormOptions
|
18
18
|
|
19
|
-
# Controls form and field
|
20
|
-
#
|
19
|
+
# Controls layout of form and field helpers. It can be "vertical,
|
20
|
+
# "horizontal", or "inline". The default value is `vertical`.
|
21
21
|
attr_accessor :layout
|
22
22
|
|
23
|
-
# A CSS class that will be applied to all form fields
|
24
|
-
#
|
23
|
+
# A CSS class that will be applied to all form fields.
|
24
|
+
# The default value is `form-control`.
|
25
25
|
attr_accessor :field_class
|
26
26
|
|
27
27
|
# An additional CSS class that will be added along with the existing
|
28
|
-
#
|
28
|
+
# css classes of field helpers. The default value is nil.
|
29
29
|
attr_accessor :additional_field_class
|
30
30
|
|
31
31
|
# Describes help text for the HTML field. Help text is automatically read
|
32
32
|
# from translation file. If you want to customize it, you can pass string.
|
33
33
|
# You can also set it false if you do not want help text displayed.
|
34
|
-
#
|
34
|
+
# The default value is nil.
|
35
35
|
attr_accessor :help_text
|
36
36
|
|
37
|
-
# An option to
|
38
|
-
#
|
37
|
+
# An option to customize automatically generated label text.
|
38
|
+
# The default value is `nil`.
|
39
39
|
attr_accessor :label_text
|
40
40
|
|
41
|
-
# An option to
|
42
|
-
#
|
41
|
+
# An option to control whether the label is to be displayed or not.
|
42
|
+
# The default value is `false`.
|
43
43
|
attr_accessor :skip_label
|
44
44
|
|
45
|
-
# An option to
|
46
|
-
#
|
45
|
+
# An option to control whether the label is only visible to a screen readers.
|
46
|
+
# The default value is `false`.
|
47
47
|
attr_accessor :hide_label
|
48
48
|
|
49
|
-
# The CSS class that will be used when the label is only accessible
|
50
|
-
# readers.
|
49
|
+
# The CSS class that will be used when the label is only accessible to a
|
50
|
+
# screen readers. The default value is `visually-hidden`.
|
51
51
|
attr_accessor :hide_class
|
52
52
|
|
53
|
-
#
|
53
|
+
# A CSS class that will be applied to all label tags when layout is
|
54
54
|
# vertical.
|
55
55
|
# The default value is `form-label`.
|
56
56
|
attr_accessor :label_class
|
57
57
|
|
58
|
-
# An additional CSS class that will be added along with the existing
|
59
|
-
#
|
58
|
+
# An additional CSS class that will be added along with the existing label
|
59
|
+
# css classes. The default value is `nil`.
|
60
60
|
attr_accessor :additional_label_class
|
61
61
|
|
62
62
|
# Input group specific options. Input groups allow prepending and appending
|
@@ -68,58 +68,57 @@ module RailsBootstrapForm
|
|
68
68
|
# form.text_field :search, bootstrap_form: {input_group: {append: button_tag("Go", type: :submit, class: "btn btn-secondary")}}
|
69
69
|
#
|
70
70
|
# Raw or HTML content to be prepended to the field.
|
71
|
-
#
|
71
|
+
# The default value is `nil`.
|
72
72
|
attr_accessor :prepend
|
73
73
|
|
74
74
|
# Raw or HTML content to be appended to the field.
|
75
|
-
#
|
75
|
+
# The default value is `nil`.
|
76
76
|
attr_accessor :append
|
77
77
|
|
78
|
-
#
|
79
|
-
#
|
78
|
+
# An additional CSS class that will be added to existing input group wrapper
|
79
|
+
# css classes. The default value is `nil`.
|
80
80
|
attr_accessor :additional_input_group_class
|
81
81
|
|
82
|
-
#
|
83
|
-
#
|
82
|
+
# An option to control whether the field should have a floating label.
|
83
|
+
# The default value is false.
|
84
84
|
attr_accessor :floating
|
85
85
|
|
86
|
-
#
|
87
|
-
#
|
86
|
+
# A CSS class that will be applied to all static fields.
|
87
|
+
# The default value is `form-control-plaintext`.
|
88
88
|
attr_accessor :static_field_class
|
89
89
|
|
90
|
-
#
|
91
|
-
#
|
90
|
+
# An option to control whether the check box should look like Bootstrap switches.
|
91
|
+
# The default value is `false`.
|
92
92
|
attr_accessor :switch
|
93
93
|
|
94
|
-
#
|
95
|
-
#
|
94
|
+
# An option to control the HTML attributes and options that will be added to
|
95
|
+
# the field wrapper. The default value is `{}`.
|
96
96
|
attr_accessor :wrapper_options
|
97
97
|
|
98
|
-
#
|
98
|
+
# An option to control the size of input groups, buttons, labels, and fields.
|
99
99
|
# The valid values are `sm` and `lg`. The default value is `nil`.
|
100
100
|
attr_accessor :size
|
101
101
|
|
102
|
-
#
|
103
|
-
# The default value
|
102
|
+
# An option to group checkboxes and radio buttons on the same horizontal row.
|
103
|
+
# The default value is `false`.
|
104
104
|
#
|
105
105
|
# Example:
|
106
106
|
# form.collection_radio_buttons :choices, ["yes", "no"], :to_s, :to_s, bootstrap_form: {inline: true}
|
107
107
|
attr_accessor :inline
|
108
108
|
|
109
|
-
#
|
110
|
-
# horizontal.
|
109
|
+
# A CSS class that will be applied to all labels when layout is horizontal.
|
111
110
|
# The default value is `col-form-label`.
|
112
111
|
attr_accessor :label_col_class
|
113
112
|
|
114
|
-
#
|
113
|
+
# A CSS class for label column when layout is horizontal.
|
115
114
|
# The default value is `col-sm-2`.
|
116
115
|
attr_accessor :label_col_wrapper_class
|
117
116
|
|
118
|
-
#
|
117
|
+
# A CSS class for field column when layout is horizontal.
|
119
118
|
# The default value is `col-sm-10`.
|
120
119
|
attr_accessor :field_col_wrapper_class
|
121
120
|
|
122
|
-
#
|
121
|
+
# An option to render submit button using `<button type="submit">` instead of
|
123
122
|
# `<input type="submit">`.
|
124
123
|
# The default value is `false`.
|
125
124
|
attr_accessor :render_as_button
|
@@ -181,6 +180,10 @@ module RailsBootstrapForm
|
|
181
180
|
@label_class = "form-label"
|
182
181
|
@additional_label_class = nil
|
183
182
|
|
183
|
+
@prepend = nil
|
184
|
+
@append = nil
|
185
|
+
@additional_input_group_class = nil
|
186
|
+
|
184
187
|
@floating = false
|
185
188
|
|
186
189
|
@static_field_class = "form-control-plaintext"
|
@@ -58,12 +58,12 @@ module RailsBootstrapForm
|
|
58
58
|
def field_wrapper_classes(bootstrap_options)
|
59
59
|
classes = []
|
60
60
|
classes << "row" if bootstrap_options.layout_horizontal?
|
61
|
-
classes << form_wrapper_default_class
|
61
|
+
classes << form_wrapper_default_class(bootstrap_options)
|
62
62
|
classes.flatten.compact
|
63
63
|
end
|
64
64
|
|
65
|
-
def form_wrapper_default_class
|
66
|
-
"mb-3"
|
65
|
+
def form_wrapper_default_class(bootstrap_options)
|
66
|
+
bootstrap_options.layout_inline? ? "col-12" : "mb-3"
|
67
67
|
end
|
68
68
|
|
69
69
|
def field_css_options(attribute, bootstrap_options, options, html_options)
|
@@ -82,7 +82,7 @@ module RailsBootstrapForm
|
|
82
82
|
css_options[:class] = field_classes.flatten.compact
|
83
83
|
css_options.merge!(required_field_options(attribute, options))
|
84
84
|
|
85
|
-
if (bootstrap_options
|
85
|
+
if placeholder_required?(bootstrap_options)
|
86
86
|
css_options[:placeholder] ||= label_text(attribute, bootstrap_options)
|
87
87
|
end
|
88
88
|
|
@@ -97,6 +97,10 @@ module RailsBootstrapForm
|
|
97
97
|
classes
|
98
98
|
end
|
99
99
|
|
100
|
+
def placeholder_required?(bootstrap_options)
|
101
|
+
(bootstrap_options.floating? && !bootstrap_options.layout_horizontal?) || bootstrap_options.layout_inline?
|
102
|
+
end
|
103
|
+
|
100
104
|
private :field_wrapper, :field_wrapper_classes, :form_wrapper_default_class,
|
101
105
|
:field_css_options, :floating_label_classes
|
102
106
|
end
|
@@ -12,11 +12,17 @@ module RailsBootstrapForm
|
|
12
12
|
value, options = nil, value if value.is_a?(Hash)
|
13
13
|
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap_form))
|
14
14
|
|
15
|
-
if (bootstrap_options.render_as_button? || block)
|
15
|
+
button_html = if (bootstrap_options.render_as_button? || block)
|
16
16
|
button(value, options, &block)
|
17
17
|
else
|
18
18
|
submit(value, options)
|
19
19
|
end
|
20
|
+
|
21
|
+
if bootstrap_options.layout_inline?
|
22
|
+
tag.div(class: "col-12") { button_html }
|
23
|
+
else
|
24
|
+
button_html
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def secondary(value = nil, options = {}, &block)
|
@@ -62,7 +62,9 @@ module RailsBootstrapForm
|
|
62
62
|
classes = Array("form-check")
|
63
63
|
classes << "form-switch" if bootstrap_options.switch?
|
64
64
|
classes << "form-check-inline" if bootstrap_options.inline?
|
65
|
-
|
65
|
+
if (bootstrap_options.layout_vertical? && !bootstrap_options.inline?)
|
66
|
+
classes << "mb-3"
|
67
|
+
end
|
66
68
|
classes.flatten.compact
|
67
69
|
end
|
68
70
|
|
@@ -11,7 +11,7 @@ module RailsBootstrapForm
|
|
11
11
|
def draw_label(attribute, options, bootstrap_options)
|
12
12
|
unless bootstrap_options.skip_label? && !bootstrap_options.floating?
|
13
13
|
label_options = {
|
14
|
-
class: label_classes(attribute, bootstrap_options)
|
14
|
+
class: label_classes(attribute, options, bootstrap_options)
|
15
15
|
}
|
16
16
|
label_options[:for] = options[:id] if options[:id].present?
|
17
17
|
label_text = label_text(attribute, bootstrap_options)
|
@@ -20,25 +20,34 @@ module RailsBootstrapForm
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def label_classes(attribute, bootstrap_options)
|
23
|
+
def label_classes(attribute, options, bootstrap_options)
|
24
24
|
classes = []
|
25
|
-
classes <<
|
25
|
+
classes << label_layout_classes(bootstrap_options)
|
26
|
+
classes << bootstrap_options.additional_label_class
|
27
|
+
classes << bootstrap_options.hide_class if hide_class_required?(bootstrap_options)
|
28
|
+
classes << "required" if is_field_required?(attribute, options)
|
29
|
+
classes << "is-invalid" if is_invalid?(attribute)
|
30
|
+
classes.flatten.compact
|
31
|
+
end
|
32
|
+
|
33
|
+
def label_layout_classes(bootstrap_options)
|
34
|
+
if bootstrap_options.layout_horizontal?
|
26
35
|
[bootstrap_options.label_col_class, bootstrap_options.label_col_wrapper_class]
|
27
36
|
else
|
28
37
|
bootstrap_options.label_class
|
29
38
|
end
|
30
|
-
classes << bootstrap_options.additional_label_class
|
31
|
-
classes << bootstrap_options.hide_class if bootstrap_options.hide_label?
|
32
|
-
classes << "required" if is_attribute_required?(attribute)
|
33
|
-
classes << "is-invalid" if is_invalid?(attribute)
|
34
|
-
classes.flatten.compact
|
35
39
|
end
|
36
40
|
|
37
41
|
def label_text(attribute, bootstrap_options)
|
38
42
|
bootstrap_options.label_text || object&.class.try(:human_attribute_name, attribute)
|
39
43
|
end
|
40
44
|
|
41
|
-
|
45
|
+
def hide_class_required?(bootstrap_options)
|
46
|
+
bootstrap_options.hide_label? || (bootstrap_options.layout_inline? && !bootstrap_options.floating?)
|
47
|
+
end
|
48
|
+
|
49
|
+
private :draw_label, :label_classes, :label_text, :label_layout_classes,
|
50
|
+
:hide_class_required?
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|
@@ -58,7 +58,9 @@ module RailsBootstrapForm
|
|
58
58
|
def radio_button_wrapper_class(bootstrap_options)
|
59
59
|
classes = Array("form-check")
|
60
60
|
classes << "form-check-inline" if bootstrap_options.inline?
|
61
|
-
|
61
|
+
if (bootstrap_options.layout_vertical? && !bootstrap_options.inline?)
|
62
|
+
classes << "mb-3"
|
63
|
+
end
|
62
64
|
classes.flatten.compact
|
63
65
|
end
|
64
66
|
|
@@ -21,7 +21,7 @@ module RailsBootstrapForm
|
|
21
21
|
options = {bootstrap_form: {field_class: "form-select"}}.deep_merge!(options)
|
22
22
|
|
23
23
|
field_wrapper_builder(attribute, options, html_options) do
|
24
|
-
tag.
|
24
|
+
tag.fieldset(class: control_specific_class(field_name)) do
|
25
25
|
super(attribute, options, html_options)
|
26
26
|
end
|
27
27
|
end
|
@@ -8,7 +8,7 @@ module RailsBootstrapForm
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
-
def collection_check_boxes(attribute, collection, value_method, text_method, options = {}, html_options = {}
|
11
|
+
def collection_check_boxes(attribute, collection, value_method, text_method, options = {}, html_options = {})
|
12
12
|
options[:multiple] = true
|
13
13
|
|
14
14
|
inputs = ActiveSupport::SafeBuffer.new
|
@@ -8,7 +8,7 @@ module RailsBootstrapForm
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
-
def collection_radio_buttons(attribute, collection, value_method, text_method, options = {}, html_options = {}
|
11
|
+
def collection_radio_buttons(attribute, collection, value_method, text_method, options = {}, html_options = {})
|
12
12
|
inputs = ActiveSupport::SafeBuffer.new
|
13
13
|
|
14
14
|
collection.each do |object|
|
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.8.1
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: generator_spec
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- demo/app/views/users/_form.html.erb
|
95
95
|
- demo/app/views/users/_form_without_bootstrap_helpers.html.erb
|
96
96
|
- demo/app/views/users/_horizontal_form.html.erb
|
97
|
+
- demo/app/views/users/_inline_form.html.erb
|
97
98
|
- demo/app/views/users/_vertical_form.html.erb
|
98
99
|
- demo/app/views/users/edit.html.erb
|
99
100
|
- demo/app/views/users/index.html.erb
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- demo/db/migrate/20230514060556_create_skills.rb
|
129
130
|
- demo/db/migrate/20230514061100_create_user_skills.rb
|
130
131
|
- demo/db/migrate/20230516044126_create_cities.rb
|
132
|
+
- demo/db/migrate/20230528041919_add_columns_in_users.rb
|
131
133
|
- demo/db/schema.rb
|
132
134
|
- demo/db/seeds.rb
|
133
135
|
- demo/public/favicon.ico
|