Module: SchedulerHelper
- Defined in:
- app/helpers/scheduler_helper.rb
Instance Method Summary collapse
Instance Method Details
#time_options_for_scheduler ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/scheduler_helper.rb', line 4 def = [] (0..23).each do |hour| [0, 15, 30, 45].each do |min| t = Time.zone.parse("2000-01-01 #{hour}:#{format('%02d', min)}") value = t.strftime('%H:%M') label = t.strftime('%-l:%M %p') << [label, value] end end end |
#time_options_for_scheduler_raw(selected = '09:00') ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/scheduler_helper.rb', line 17 def (selected = '09:00') = [] (0..23).each do |hour| [0, 15, 30, 45].each do |min| t = Time.zone.parse("2000-01-01 #{hour}:#{format('%02d', min)}") value = t.strftime('%H:%M') label = t.strftime('%-l:%M %p') sel = value == selected ? ' selected' : '' << %(<option value="#{value}"#{sel}>#{label}</option>) end end .join.html_safe end |