Created
January 18, 2011 21:51
-
-
Save janv/785233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time_select = (time_str) -> | |
time_str = time_str.match /(\d+):(\d+)/ | |
if (time_str) | |
[h, m] = time_str[1..2] | |
hour_options = for hour in [0...24] | |
hour_s = if hour < 10 then "0#{hour}" else hour | |
"<option #{if hour == h then 'selected' else ''}>#{hour_s}</option>" # TODO Coffee == -> === macht wahrscheinlich stress | |
minute_options = for minute in [0...60] | |
minute_s = if minute < 10 then "0#{minute}" else minute | |
"<option #{if minute == m then 'selected' else ''}>#{minute_s}</option>" | |
''' | |
<select class="time_h"> | |
#{hour_options.join('')} | |
</select>:<select class="time_m"> | |
#{minute_options.join('')} | |
</select> | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment