diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 15:57:32 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 15:57:32 -0300 |
commit | a3bda38467377cb8c3cdd52b6fcf6c6c31f74b82 (patch) | |
tree | 44a3f5ac94d5ea4ea5219b669d91e0e17a674d74 /actionpack/lib/action_view | |
parent | 5a84d3eb81d8d5c24233b29276aa0a0d9f7f9cb9 (diff) | |
parent | 666e9f65bdfeb6cc5aa80b6254608adc3d7845ce (diff) | |
download | rails-a3bda38467377cb8c3cdd52b6fcf6c6c31f74b82.tar.gz rails-a3bda38467377cb8c3cdd52b6fcf6c6c31f74b82.tar.bz2 rails-a3bda38467377cb8c3cdd52b6fcf6c6c31f74b82.zip |
Merge branch '3-2-17' into 3-2-stable
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 14 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/text.rb | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 2e04ff453d..8ebd7e2f35 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -138,12 +138,18 @@ module ActionView options.symbolize_keys! + options[:delimiter] = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter] + options[:separator] = ERB::Util.html_escape(options[:separator]) if options[:separator] + options[:format] = ERB::Util.html_escape(options[:format]) if options[:format] + options[:negative_format] = ERB::Util.html_escape(options[:negative_format]) if options[:negative_format] + defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {}) currency = I18n.translate(:'number.currency.format', :locale => options[:locale], :default => {}) currency[:negative_format] ||= "-" + currency[:format] if currency[:format] defaults = DEFAULT_CURRENCY_VALUES.merge(defaults).merge!(currency) defaults[:negative_format] = "-" + options[:format] if options[:format] + options = defaults.merge!(options) unit = options.delete(:unit) @@ -206,6 +212,9 @@ module ActionView options.symbolize_keys! + options[:delimiter] = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter] + options[:separator] = ERB::Util.html_escape(options[:separator]) if options[:separator] + defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {}) percentage = I18n.translate(:'number.percentage.format', :locale => options[:locale], :default => {}) defaults = defaults.merge(percentage) @@ -255,6 +264,9 @@ module ActionView def number_with_delimiter(number, options = {}) options.symbolize_keys! + options[:delimiter] = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter] + options[:separator] = ERB::Util.html_escape(options[:separator]) if options[:separator] + begin Float(number) rescue ArgumentError, TypeError @@ -578,7 +590,7 @@ module ActionView units = options.delete :units unit_exponents = case units when Hash - units + units = Hash[units.map { |k, v| [k, ERB::Util.html_escape(v)] }] when String, Symbol I18n.translate(:"#{units}", :locale => options[:locale], :raise => true) when nil diff --git a/actionpack/lib/action_view/template/text.rb b/actionpack/lib/action_view/template/text.rb index 4261c3b5e2..d90e43b8f1 100644 --- a/actionpack/lib/action_view/template/text.rb +++ b/actionpack/lib/action_view/template/text.rb @@ -23,7 +23,7 @@ module ActionView #:nodoc: end def formats - [@mime_type.to_sym] + [@mime_type.respond_to?(:ref) ? @mime_type.ref : @mime_type.to_s] end end end |