aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/date_helper.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2010-08-26 22:07:56 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-27 01:18:42 -0300
commit0aefbe52a08d60184c05a91173ad2eb256fb50c0 (patch)
tree9c2ee6c9e6f1c753e7429480a745c4cdf77a8f53 /actionpack/lib/action_view/helpers/date_helper.rb
parent27edd3f8bc46fca6f7e81e1e611bd025cd360b66 (diff)
downloadrails-0aefbe52a08d60184c05a91173ad2eb256fb50c0.tar.gz
rails-0aefbe52a08d60184c05a91173ad2eb256fb50c0.tar.bz2
rails-0aefbe52a08d60184c05a91173ad2eb256fb50c0.zip
Removing some unuseful begin/end and refactor prompt_option_tag a bit
[#5469 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/lib/action_view/helpers/date_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb27
1 files changed, 11 insertions, 16 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 8050669adb..1127792315 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -751,10 +751,8 @@ module ActionView
# => [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
# "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
def translated_month_names
- begin
- key = @options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'
- I18n.translate(key, :locale => @options[:locale])
- end
+ key = @options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'
+ I18n.translate(key, :locale => @options[:locale])
end
# Lookup month name for number
@@ -781,9 +779,7 @@ module ActionView
memoize :date_order
def translated_date_order
- begin
- I18n.translate(:'date.order', :locale => @options[:locale]) || []
- end
+ I18n.translate(:'date.order', :locale => @options[:locale]) || []
end
# Build full select tag from date type and options
@@ -837,15 +833,14 @@ module ActionView
# prompt_option_tag(:month, :prompt => 'Select month')
# => "<option value="">Select month</option>"
def prompt_option_tag(type, options)
- default_options = {:year => false, :month => false, :day => false, :hour => false, :minute => false, :second => false}
-
- case options
- when Hash
- prompt = default_options.merge(options)[type.to_sym]
- when String
- prompt = options
- else
- prompt = I18n.translate(('datetime.prompts.' + type.to_s).to_sym, :locale => @options[:locale])
+ prompt = case options
+ when Hash
+ default_options = {:year => false, :month => false, :day => false, :hour => false, :minute => false, :second => false}
+ default_options.merge!(options)[type.to_sym]
+ when String
+ options
+ else
+ I18n.translate(:"datetime.prompts.#{type}", :locale => @options[:locale])
end
prompt ? content_tag(:option, prompt, :value => '') : ''