aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-13 05:15:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-13 05:15:41 +0000
commitc29db9f210c81a757e035ee6c8e1a055f6b676b3 (patch)
treeb0304a1908769172bb0aae4680493a28673a05bd /actionpack/lib
parente0a2dab8166d67c556ab9abc13fb673d2eee1e20 (diff)
downloadrails-c29db9f210c81a757e035ee6c8e1a055f6b676b3.tar.gz
rails-c29db9f210c81a757e035ee6c8e1a055f6b676b3.tar.bz2
rails-c29db9f210c81a757e035ee6c8e1a055f6b676b3.zip
Added minute_step as an option to select_minute (and the helpers that use it) to jump in larger increments than just 1 minute. At 15, it would return 0, 15, 30, 45 options #1085 [ordwaye@evergreen.edu]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1154 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-xactionpack/lib/action_view/helpers/date_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 9ffafe70b4..6f9545983c 100755
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -114,11 +114,12 @@ module ActionView
end
# Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected.
+ # Also can return a select tag with options by <tt>minute_step</tt> from 0 through 59 with the 00 minute selected
# The <tt>minute</tt> can also be substituted for a minute number.
def select_minute(datetime, options = {})
minute_options = []
- 0.upto(59) do |minute|
+ 0.step(59, options[:minute_step] || 1) do |minute|
minute_options << ((datetime && (datetime.kind_of?(Fixnum) ? datetime : datetime.min) == minute) ?
"<option selected=\"selected\">#{leading_zero_on_single_digits(minute)}</option>\n" :
"<option>#{leading_zero_on_single_digits(minute)}</option>\n"