From b62243a5cc957ae0c7380bf8e020219e45366fe2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Sep 2005 05:58:00 +0000 Subject: Added :disabled option to all data selects that'll make the elements inaccessible for change #2167, #253 [eigentone] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2184 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/date_helper.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_view/helpers/date_helper.rb') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index a516072acb..6323006bd0 100755 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -62,6 +62,8 @@ module ActionView # set the order of the tags using the :order option with an array of symbols :year, :month and :day in # the desired order. Symbols may be omitted and the respective select is not included. # + # Passing :disabled => true as part of the +options+ will make elements inaccessible for change. + # # NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed. # # Examples: @@ -118,7 +120,7 @@ module ActionView ) end - select_html(options[:field_name] || 'second', second_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'second', second_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end # Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected. @@ -135,7 +137,7 @@ module ActionView ) end - select_html(options[:field_name] || 'minute', minute_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'minute', minute_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end # Returns a select tag with options for each of the hours 0 through 23 with the current hour selected. @@ -151,7 +153,7 @@ module ActionView ) end - select_html(options[:field_name] || 'hour', hour_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'hour', hour_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end # Returns a select tag with options for each of the days 1 through 31 with the current day selected. @@ -167,7 +169,7 @@ module ActionView ) end - select_html(options[:field_name] || 'day', day_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'day', day_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end # Returns a select tag with options for each of the months January through December with the current month selected. @@ -203,7 +205,7 @@ module ActionView ) end - select_html(options[:field_name] || 'month', month_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'month', month_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end # Returns a select tag with options for each of the five years on each side of the current, which is selected. The five year radius @@ -229,14 +231,16 @@ module ActionView ) end - select_html(options[:field_name] || 'year', year_options, options[:prefix], options[:include_blank], options[:discard_type]) + select_html(options[:field_name] || 'year', year_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled]) end private - def select_html(type, options, prefix = nil, include_blank = false, discard_type = false) + def select_html(type, options, prefix = nil, include_blank = false, discard_type = false, disabled = false) select_html = %(\n" -- cgit v1.2.3