Commit 72ae150b authored by Tyler R Lemburg's avatar Tyler R Lemburg
Browse files

Merge branch 'time-improvements' into 'master'

Improve reservation length editing

This does two things:

1) defaults the reservation length to 1 hour when the length can be selected.
2) the saved reservation length is selected by default when editing a reservation (instead of defaulting to the 1st option)

I did this assuming that the select is used mostly for room reservations, which are usually one hour reservations (in my experience).

Also, my ruby-fu is lacking, so there might be a better way to do this?

See merge request !4
parents 3e1e6cb3 a5b3a3d5
......@@ -178,11 +178,13 @@ EIGHT_PM_MINUTES = 1200 # end time of calendar
</select>
<% else resource.minutes_per_reservation.nil? %>
<select id="reservation-length" name="length">
<% (1..4).each do |i| %>
<option value="<%=i*15%>"><%=i*15%> minutes</option>
<% (1..3).each do |i| %>
<% min = i*15 %>
<option value="<%=min%>" <%= (!reservation.nil? && reservation.length == min)? "selected" : "" %>><%=min%> minutes</option>
<% end %>
<option value="90">1.5 hours</option>
<option value="120">2 hours</option>
<option value="60" <%= (reservation.nil? || reservation.length == 60)? "selected" : "" %>>1 hour</option>
<option value="90" <%= (!reservation.nil? && reservation.length == 90)? "selected" : "" %>>1.5 hours</option>
<option value="120" <%= (!reservation.nil? && reservation.length == 120)? "selected" : "" %>>2 hours</option>
</select>
<% end %>
<label for="title">Name of Reservation: (e.g. "Group Meeting")</label>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment