From 8fac2c88cae0f2fd42fad3c2c2c6c860df14d629 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 14 May 2009 15:30:35 -0700 Subject: Cleaning up more render tests --- actionpack/lib/action_view/helpers/tag_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index af8c4d5e21..66d7592874 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -9,7 +9,7 @@ module ActionView include ERB::Util BOOLEAN_ATTRIBUTES = %w(disabled readonly multiple checked).to_set - BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map(&:to_sym)) + BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attr| attr.to_sym }) # Returns an empty HTML tag of type +name+ which by default is XHTML # compliant. Set +open+ to true to create an open tag compatible -- cgit v1.2.3 From eb021707f53be46140b55a48e5ef03ed0577a45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 1 Apr 2009 12:44:56 +0200 Subject: Allow strings to be sent as collection to select. Signed-off-by: Michael Koziarski --- actionpack/lib/action_view/helpers/form_options_helper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 6b385ef77d..6adbab175f 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -230,6 +230,8 @@ module ActionView # # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def options_for_select(container, selected = nil) + return container if String === container + container = container.to_a if Hash === container selected, disabled = extract_selected_and_disabled(selected) -- cgit v1.2.3 From db1bf3650d7450811f5dfddc5c5163a70683e37a Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 16 May 2009 12:13:41 -0700 Subject: Fix ActionMailer Symbol#to_proc instance --- actionpack/lib/action_view/template/handlers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb index 0590372d09..faf54b9fe5 100644 --- a/actionpack/lib/action_view/template/handlers.rb +++ b/actionpack/lib/action_view/template/handlers.rb @@ -33,7 +33,7 @@ module ActionView #:nodoc: end def template_handler_extensions - @@template_handlers.keys.map(&:to_s).sort + @@template_handlers.keys.map {|key| key.to_s }.sort end def registered_template_handler(extension) -- cgit v1.2.3 From 11bac700784efe232083f94e3d28d171957e667e Mon Sep 17 00:00:00 2001 From: Lance Ivy Date: Wed, 15 Apr 2009 16:46:30 -0700 Subject: Ensure auto_link does not ignore multiple trailing punctuations [#2504 state:resolved] Signed-off-by: Pratik Naik --- actionpack/lib/action_view/helpers/text_helper.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 573b99b96e..8136a1cb13 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -535,7 +535,7 @@ module ActionView link_attributes = html_options.stringify_keys text.gsub(AUTO_LINK_RE) do href = $& - punctuation = '' + punctuation = [] left, right = $`, $' # detect already linked URLs and URLs in the middle of a tag if left =~ /<[^>]+$/ && right =~ /^[^>]*>/ @@ -543,17 +543,18 @@ module ActionView href else # don't include trailing punctuation character as part of the URL - if href.sub!(/[^\w\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation] - if href.scan(opening).size > href.scan(punctuation).size - href << punctuation - punctuation = '' + while href.sub!(/[^\w\/-]$/, '') + punctuation.push $& + if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size + href << punctuation.pop + break end end link_text = block_given?? yield(href) : href href = 'http://' + href unless href.index('http') == 0 - content_tag(:a, h(link_text), link_attributes.merge('href' => href)) + punctuation + content_tag(:a, h(link_text), link_attributes.merge('href' => href)) + punctuation.reverse.join('') end end end -- cgit v1.2.3 From 98eaa2c6834e418959f2a1a18421e4811167e03b Mon Sep 17 00:00:00 2001 From: Travis Briggs Date: Wed, 18 Mar 2009 21:51:26 -0400 Subject: Ensure number_to_human_size does not strip zeros from the end [#1763 state:resolved] Signed-off-by: Pratik Naik --- actionpack/lib/action_view/helpers/number_helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index c02692b09a..999d5b34fc 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -248,6 +248,11 @@ module ActionView # number_to_human_size(483989, :precision => 0) # => 473 KB # number_to_human_size(1234567, :precision => 2, :separator => ',') # => 1,18 MB # + # Zeros after the decimal point are always stripped out, regardless of the + # specified precision: + # helper.number_to_human_size(1234567890123, :precision => 5) # => "1.12283 TB" + # helper.number_to_human_size(524288000, :precision=>5) # => "500 MB" + # # You can still use number_to_human_size with the old API that accepts the # +precision+ as its optional second parameter: # number_to_human_size(1234567, 2) # => 1.18 MB @@ -293,7 +298,7 @@ module ActionView :precision => precision, :separator => separator, :delimiter => delimiter - ).sub(/(\d)(#{escaped_separator}[1-9]*)?0+\z/, '\1\2').sub(/#{escaped_separator}\z/, '') + ).sub(/(#{escaped_separator})(\d*[1-9])?0+\z/, '\1\2').sub(/#{escaped_separator}\z/, '') storage_units_format.gsub(/%n/, formatted_number).gsub(/%u/, unit) rescue number -- cgit v1.2.3