Replace content_tag with new tag builder syntax

One of the main advantages of this syntax is we can now omit the content
parameter when it's empty.
This commit is contained in:
Javi Martín
2019-06-21 00:57:06 +02:00
parent fa070f326e
commit 749428d93f
16 changed files with 36 additions and 39 deletions

View File

@@ -21,7 +21,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
def check_box(attribute, options = {})
if options[:label] != false
label = content_tag(:span, sanitize(label_text(object, attribute, options[:label])), class: "checkbox")
label = tag.span sanitize(label_text(object, attribute, options[:label])), class: "checkbox"
super(attribute, options.merge(label: label, label_options: label_options_for(options)))
else
@@ -70,7 +70,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
def help_text(attribute, options)
if options[:hint]
content_tag :span, options[:hint], class: "help-text", id: help_text_id(attribute, options)
tag.span options[:hint], class: "help-text", id: help_text_id(attribute, options)
end
end