##// END OF EJS Templates
Rails3: use String#html_safe for label_for_field() at lib/tabular_form_builder.rb....
Toshi MARUYAMA -
r6353:89fd138503ba
parent child
Show More
@@ -40,11 +40,11 class TabularFormBuilder < ActionView::Helpers::FormBuilder
40
40
41 # Returns a label tag for the given field
41 # Returns a label tag for the given field
42 def label_for_field(field, options = {})
42 def label_for_field(field, options = {})
43 return '' if options.delete(:no_label)
43 return ''.html_safe if options.delete(:no_label)
44 text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label]
44 text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label]
45 text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym)
45 text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym)
46 text += @template.content_tag("span", " *", :class => "required") if options.delete(:required)
46 text += @template.content_tag("span", " *", :class => "required") if options.delete(:required)
47 @template.content_tag("label", text,
47 @template.content_tag("label", text.html_safe,
48 :class => (@object && @object.errors[field] ? "error" : nil),
48 :class => (@object && @object.errors[field] ? "error" : nil),
49 :for => (@object_name.to_s + "_" + field.to_s))
49 :for => (@object_name.to_s + "_" + field.to_s))
50 end
50 end
General Comments 0
You need to be logged in to leave comments. Login now