/
date.erb
50 lines (46 loc) · 1.64 KB
/
date.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<div class="date">
<label class="long" for="day"><%= title %></label>
<select id="<%= label %>_day" name="<%= label %>_day">
<%if day%>
<option value=""></option>
<%else%>
<option selected="selected" value=""></option>
<% end %>
<% for oneday in 1 .. 31 %>
<% if oneday.to_s == day %>
<option selected="selected" value="<%= oneday %>"><%= oneday %></option>
<% else %>
<option value="<%= oneday %>"><%= oneday %></option>
<% end %>
<% end %>
</select>
<select id="<%= label %>_month" name="<%= label %>_month">
<% months = {1=>"January", 2=>"February", 3=>"March", 4=>"April", 5=>"May", 6=>"June", 7=>"July", 8=>"August", 9=>"September", 10=>"October", 11=>"November", 12=>"December"} %>
<%if month%>
<option value=""></option>
<%else%>
<option selected="selected" value=""></option>
<% end %>
<% for onemonth in months %>
<% if onemonth[0].to_s == month %>
<option selected="selected" value= <%= onemonth[0] %>><%= onemonth[1] %></option>
<% else %>
<option value= <%= onemonth[0] %>><%= onemonth[1] %></option>
<% end %>
<% end %>
</select>
<select id="<%= label %>_year" name="<%= label %>_year">
<%if year%>
<option value=""></option>
<%else%>
<option selected="selected" value=""></option>
<% end %>
<% for oneyear in Time.now.year .. Time.now.year+5 %>
<% if oneyear.to_s == year %>
<option selected="selected" value= <%= oneyear %>><%= oneyear %></option>
<% else %>
<option value= <%= oneyear %>><%= oneyear %></option>
<% end %>
<% end %>
</select>
</div>