Skip to content

Commit 1bfe0f7

Browse files
committed
Rename methods for non-fieldset approach
1 parent ccce219 commit 1bfe0f7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lib/bootstrap_form/inputs/inputs_collection.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ module InputsCollection
88
private
99

1010
def inputs_collection(name, collection, value, text, options={}, &)
11-
if BootstrapForm.config.group_around_collections
12-
return fieldset_inputs_collection(name, collection, value, text, options, &)
13-
end
11+
return group_inputs_collection(name, collection, value, text, options, &) if BootstrapForm.config.group_around_collections
1412

1513
options[:label] ||= { class: group_label_class(field_layout(options)) }
1614
options[:inline] ||= layout_inline?(options[:layout])
@@ -63,11 +61,11 @@ def form_group_collection_input_checked?(checked, obj, input_value)
6361
checked == obj || Array(checked).try(:include?, obj)
6462
end
6563

66-
def fieldset_inputs_collection(name, collection, value, text, options={}, &)
64+
def group_inputs_collection(name, collection, value, text, options={}, &)
6765
options[:label] ||= { class: group_label_class(field_layout(options)) }
6866
options[:inline] ||= layout_inline?(options[:layout])
6967

70-
fieldset_builder(name, options) do
68+
group_builder(name, options) do
7169
inputs = ActiveSupport::SafeBuffer.new
7270

7371
collection.each_with_index do |obj, i|
@@ -80,7 +78,7 @@ def fieldset_inputs_collection(name, collection, value, text, options={}, &)
8078
end
8179
end
8280

83-
def fieldset_builder(method, options, html_options=nil, &)
81+
def group_builder(method, options, html_options=nil, &)
8482
no_wrapper = options[:wrapper] == false
8583

8684
options = form_group_builder_options(options, method)
@@ -110,18 +108,18 @@ def field_group(name, options, &)
110108
aria: { labelledby: options[:id] || default_id(name) },
111109
role: :group
112110
) do
113-
legend = generate_legend(name, options)
111+
group_label = generate_group_label(name, options)
114112
prepare_label_options(options[:id], name, options[:label], options[:label_col], options[:layout])
115-
form_group_content(legend, generate_help(name, options[:help]), options, &)
113+
form_group_content(group_label, generate_help(name, options[:help]), options, &)
116114
end
117115
end
118116

119-
def generate_legend(name, options)
120-
legend_class = options.dig(:label, :class) || "form-label"
117+
def generate_group_label(name, options)
118+
group_label_class = options.dig(:label, :class) || "form-label"
121119
id = options[:id] || default_id(name)
122120

123121
tag.div(
124-
**{ class: legend_class }.compact,
122+
**{ class: group_label_class }.compact,
125123
id:
126124
) { label_text(name, options.dig(:label, :text)) }
127125
end

0 commit comments

Comments
 (0)