Skip to content

Commit

Permalink
Allow disabling escape_xml
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Dec 16, 2008
1 parent d5c1e89 commit 677d08b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions merb-helpers/lib/merb-helpers/form/builder.rb
Expand Up @@ -243,9 +243,14 @@ def options(col, text_meth, value_meth, sel, b = nil)
([b] + col.map do |item| ([b] + col.map do |item|
text_meth = text_meth && item.respond_to?(text_meth) ? text_meth : :last text_meth = text_meth && item.respond_to?(text_meth) ? text_meth : :last
value_meth = value_meth && item.respond_to?(value_meth) ? value_meth : :first value_meth = value_meth && item.respond_to?(value_meth) ? value_meth : :first

text = item.is_a?(String) ? item : item.send(text_meth)
value = item.is_a?(String) ? item : item.send(value_meth)


text = item.is_a?(String) ? item : Merb::Parse.escape_xml(item.send(text_meth)) unless Merb.disabled?(:merb_helper_escaping)
value = item.is_a?(String) ? item : Merb::Parse.escape_xml(item.send(value_meth)) text = Merb::Parse.escape_xml(text)
value = Merb::Parse.escape_xml(value)
end


option_attrs = {:value => value} option_attrs = {:value => value}
if sel.is_a?(Array) if sel.is_a?(Array)
Expand All @@ -272,7 +277,11 @@ def control_name(method)


def control_value(method) def control_value(method)
value = @obj ? @obj.send(method) : @origin.params[method] value = @obj ? @obj.send(method) : @origin.params[method]
Merb::Parse.escape_xml(value.to_s) if Merb.disabled?(:merb_helper_escaping)
value.to_s
else
Merb::Parse.escape_xml(value.to_s)
end
end end


def add_css_class(attrs, new_class) def add_css_class(attrs, new_class)
Expand Down

0 comments on commit 677d08b

Please sign in to comment.