1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

add more documentation; remove unused assignment

This commit is contained in:
Aditya Sanghi 2011-04-29 02:03:56 +05:30
parent a869382a9f
commit 610e4d9f24

View file

@ -207,7 +207,8 @@ module ActionView
# Returns a set of select tags (one for hour, minute and optionally second) pre-selected for accessing a # Returns a set of select tags (one for hour, minute and optionally second) pre-selected for accessing a
# specified time-based attribute (identified by +method+) on an object assigned to the template (identified by # specified time-based attribute (identified by +method+) on an object assigned to the template (identified by
# +object+). You can include the seconds with <tt>:include_seconds</tt>. # +object+). You can include the seconds with <tt>:include_seconds</tt>. You can get hours in the AM/PM format
# with <tt>:ampm</tt> option.
# #
# This method will also generate 3 input hidden tags, for the actual year, month and day unless the option # This method will also generate 3 input hidden tags, for the actual year, month and day unless the option
# <tt>:ignore_date</tt> is set to +true+. # <tt>:ignore_date</tt> is set to +true+.
@ -230,6 +231,9 @@ module ActionView
# time_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours # time_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
# time_select("post", "written_on", :prompt => true) # generic prompts for all # time_select("post", "written_on", :prompt => true) # generic prompts for all
# #
# # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
# time_select 'game', 'game_time', {:ampm => true}
#
# The selects are prepared for multi-parameter assignment to an Active Record object. # The selects are prepared for multi-parameter assignment to an Active Record object.
# #
# Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that # Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that
@ -257,6 +261,9 @@ module ActionView
# # be stored in the trip variable in the departing attribute. # # be stored in the trip variable in the departing attribute.
# datetime_select("trip", "departing", :default => 3.days.from_now) # datetime_select("trip", "departing", :default => 3.days.from_now)
# #
# # Generate a datetime select with hours in the AM/PM format
# datetime_select("post", "written_on", :ampm => true)
#
# # Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable # # Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable
# # as the written_on attribute. # # as the written_on attribute.
# datetime_select("post", "written_on", :discard_type => true) # datetime_select("post", "written_on", :discard_type => true)
@ -306,6 +313,9 @@ module ActionView
# # my_date_time (four days after today) # # my_date_time (four days after today)
# select_datetime(my_date_time, :discard_type => true) # select_datetime(my_date_time, :discard_type => true)
# #
# # Generate a datetime field with hours in the AM/PM format
# select_datetime(my_date_time, :ampm => true)
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today) # # Generates a datetime select that defaults to the datetime in my_date_time (four days after today)
# # prefixed with 'payday' rather than 'date' # # prefixed with 'payday' rather than 'date'
# select_datetime(my_date_time, :prefix => 'payday') # select_datetime(my_date_time, :prefix => 'payday')
@ -387,6 +397,9 @@ module ActionView
# # separated by ':' and includes an input for seconds # # separated by ':' and includes an input for seconds
# select_time(my_time, :time_separator => ':', :include_seconds => true) # select_time(my_time, :time_separator => ':', :include_seconds => true)
# #
# # Generate a time select field with hours in the AM/PM format
# select_time(my_time, :ampm => true)
#
# # Generates a time select with a custom prompt. Use :prompt=>true for generic prompts. # # Generates a time select with a custom prompt. Use :prompt=>true for generic prompts.
# select_time(my_time, :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'}) # select_time(my_time, :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
# select_time(my_time, :prompt => {:hour => true}) # generic prompt for hours # select_time(my_time, :prompt => {:hour => true}) # generic prompt for hours
@ -603,9 +616,6 @@ module ActionView
POSITION = { POSITION = {
:year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6
}.freeze }.freeze
ampm = ["AM","PM"].map do |s|
["12 #{s}"] + (1..11).map{|x| "#{sprintf('%02d',x)} #{s}"}
end.flatten
AMPM_TRANSLATION = Hash[ AMPM_TRANSLATION = Hash[
[[0, "12 AM"], [1, "01 AM"], [2, "02 AM"], [3, "03 AM"], [[0, "12 AM"], [1, "01 AM"], [2, "02 AM"], [3, "03 AM"],