diff options
Diffstat (limited to 'actionview/lib/action_view/helpers/date_helper.rb')
-rw-r--r-- | actionview/lib/action_view/helpers/date_helper.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 74c6f0ab1c..61ce1d36e0 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -1011,12 +1011,13 @@ module ActionView # css_class_attribute(:year, 'date optional', { year: 'my-year' }) # => "date optional my-year" def css_class_attribute(type, html_options_class, options) # :nodoc: - css_class = case options - when Hash - options[type.to_sym] - else - type - end + css_class = \ + case options + when Hash + options[type.to_sym] + else + type + end [html_options_class, css_class].compact.join(" ") end @@ -1025,15 +1026,16 @@ module ActionView # prompt_option_tag(:month, prompt: 'Select month') # => "<option value="">Select month</option>" def prompt_option_tag(type, options) - 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 + 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 + I18n.translate(:"datetime.prompts.#{type}", locale: @options[:locale]) + end prompt ? content_tag("option".freeze, prompt, value: "") : "" end |