Simplify passing the object in the form builder

The object is already a method, so we don't need to pass it around.
This commit is contained in:
Javi Martín
2020-06-25 15:12:07 +02:00
parent 9761558d01
commit f49745d7ba

View File

@@ -21,7 +21,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
def check_box(attribute, options = {}) def check_box(attribute, options = {})
if options[:label] != false if options[:label] != false
label = tag.span sanitize(label_text(object, attribute, options[:label])), class: "checkbox" label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox"
super(attribute, options.merge(label: label, label_options: label_options_for(options))) super(attribute, options.merge(label: label, label_options: label_options_for(options)))
else else
@@ -41,7 +41,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
if text == false if text == false
super super
else else
super(attribute, sanitize(label_text(object, attribute, text)), options) super(attribute, sanitize(label_text(attribute, text)), options)
end end
end end
@@ -50,7 +50,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
help_text(attribute, options) help_text(attribute, options)
end end
def label_text(object, attribute, text) def label_text(attribute, text)
if text.nil? || text == true if text.nil? || text == true
default_label_text(object, attribute) default_label_text(object, attribute)
else else