Skip to content
Snippets Groups Projects
Commit 1ddc6e60 authored by Tyler Lemburg's avatar Tyler Lemburg
Browse files

Add titles to reservations

parent 7fa4223d
Branches
No related tags found
No related merge requests found
Pipeline #
require 'active_record'
class AddReservationName < ActiveRecord::Migration
def change
add_column :reservations, :title, :string
end
end
\ No newline at end of file
...@@ -225,7 +225,8 @@ post '/:service_space_url_name/resources/:resource_id/reserve/?' do ...@@ -225,7 +225,8 @@ post '/:service_space_url_name/resources/:resource_id/reserve/?' do
:start_time => start_time, :start_time => start_time,
:end_time => end_time, :end_time => end_time,
:is_training => false, :is_training => false,
:user_id => @user.id :user_id => @user.id,
:title => params[:title]
) )
flash(:success, 'Reservation Created', "You have successfully reserved #{resource.name} for #{params[:length]} minutes at #{start_time.in_time_zone.strftime('%A, %B %d at %l:%M %P')}") flash(:success, 'Reservation Created', "You have successfully reserved #{resource.name} for #{params[:length]} minutes at #{start_time.in_time_zone.strftime('%A, %B %d at %l:%M %P')}")
...@@ -393,7 +394,8 @@ post '/:service_space_url_name/resources/:resource_id/edit_reservation/:reservat ...@@ -393,7 +394,8 @@ post '/:service_space_url_name/resources/:resource_id/edit_reservation/:reservat
reservation.update( reservation.update(
:start_time => start_time, :start_time => start_time,
:end_time => end_time :end_time => end_time,
:title => params[:title]
) )
flash(:success, 'Reservation Updated', "You have successfully updated your reservation for #{resource.name}: it is now for #{params[:length]} minutes at #{start_time.in_time_zone.strftime('%A, %B %d at %l:%M %P')}") flash(:success, 'Reservation Updated', "You have successfully updated your reservation for #{resource.name}: it is now for #{params[:length]} minutes at #{start_time.in_time_zone.strftime('%A, %B %d at %l:%M %P')}")
......
...@@ -56,7 +56,8 @@ end %> ...@@ -56,7 +56,8 @@ end %>
<% if !res.event.nil? %> <% if !res.event.nil? %>
<%= res.event.title %> <%= res.event.title %>
<% else %> <% else %>
<%= res.user_id == @user.id ? 'My Reservation' : 'busy' %> <%= res.title ? (res.title.empty? ? 'Reserved' : res.title) : 'Reserved' %>
<%= res.user_id == @user.id ? '(My Reservation)' : '' %>
<% end %> <% end %>
<%= '(Editing)' if !reservation.nil? && reservation.id == res.id %> <%= '(Editing)' if !reservation.nil? && reservation.id == res.id %>
</div> </div>
...@@ -175,6 +176,8 @@ end %> ...@@ -175,6 +176,8 @@ end %>
<option value="120">2 hours</option> <option value="120">2 hours</option>
</select> </select>
<% end %> <% end %>
<label for="title">Name of Reservation: (e.g. "Group Meeting")</label>
<input type="text" name="title" id="title" value="<%= reservation.title unless reservation.nil? %>">
<br><br> <br><br>
<button type="submit" class="wdn-button wdn-button-brand"><%= reservation.nil? ? 'Reserve' : 'Update' %></button> <button type="submit" class="wdn-button wdn-button-brand"><%= reservation.nil? ? 'Reserve' : 'Update' %></button>
</div> </div>
......
...@@ -21,8 +21,8 @@ end %> ...@@ -21,8 +21,8 @@ end %>
<h4 style="text-align: center; margin: 0;"> <h4 style="text-align: center; margin: 0;">
<%= month = sunday.strftime('%B %Y') %><%= (month2 = (sunday+6.days).strftime('%B %Y')) == month ? '' : " - #{month2}" %> <%= month = sunday.strftime('%B %Y') %><%= (month2 = (sunday+6.days).strftime('%B %Y')) == month ? '' : " - #{month2}" %>
</h4> </h4>
<a href="/<%= @space.url_name %>/resources/<%= resource.id %>/calendar/?date=<%= (date-7.days).strftime('%Y-%m-%d') %>" class="wdn-button wdn-button-triad" id="prev-week">&lt; PREV</a> <a href="/<%= @space.url_name %>/resources/<%= resource.id %>/calendar/?date=<%= (date-7.days).strftime('%Y-%m-%d') %><%= defined?(kiosk_mode) && kiosk_mode == 'true' ? '&kiosk_mode=true' : ''%>" class="wdn-button wdn-button-triad" id="prev-week">&lt; PREV</a>
<a href="/<%= @space.url_name %>/resources/<%= resource.id %>/calendar/?date=<%= (date+7.days).strftime('%Y-%m-%d') %>" class="wdn-button wdn-button-triad" style="float: right;" id="next-week">NEXT &gt;</a> <a href="/<%= @space.url_name %>/resources/<%= resource.id %>/calendar/?date=<%= (date+7.days).strftime('%Y-%m-%d') %><%= defined?(kiosk_mode) && kiosk_mode == 'true' ? '&kiosk_mode=true' : ''%>" class="wdn-button wdn-button-triad" style="float: right;" id="next-week">NEXT &gt;</a>
</div> </div>
<div class="calendar-container"> <div class="calendar-container">
...@@ -142,7 +142,7 @@ end %> ...@@ -142,7 +142,7 @@ end %>
%> %>
<div class="event <%= 'top-overflow' if top_overflow %> <%= 'bottom-overflow' if bottom_overflow %>" <div class="event <%= 'top-overflow' if top_overflow %> <%= 'bottom-overflow' if bottom_overflow %>"
style="top: <%= top %>px; height: <%= height %>px; left: <%=over*8%>px"> style="top: <%= top %>px; height: <%= height %>px; left: <%=over*8%>px">
<%= 'a reservation' %> <%= res.title ? (res.title.empty? ? 'Reserved' : res.title) : 'Reserved' %>
</div> </div>
<% (start_slot..end_slot).each do |k| %> <% (start_slot..end_slot).each do |k| %>
<% slots[k] = slots[k] + 1 %> <% slots[k] = slots[k] + 1 %>
......
...@@ -12,8 +12,7 @@ You have no upcoming reservations. You can view upcoming trainings to get certif ...@@ -12,8 +12,7 @@ You have no upcoming reservations. You can view upcoming trainings to get certif
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Tool</th> <th>Resource</th>
<th>Model</th>
<th>Time</th> <th>Time</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
...@@ -27,9 +26,6 @@ You have no upcoming reservations. You can view upcoming trainings to get certif ...@@ -27,9 +26,6 @@ You have no upcoming reservations. You can view upcoming trainings to get certif
<br><small><%= reservation.event.title %></small> <br><small><%= reservation.event.title %></small>
<% end %> <% end %>
</td> </td>
<td>
<%= reservation.resource.model %>
</td>
<td> <td>
<%= reservation.start_time.in_time_zone.strftime('%m/%d/%Y @ %l:%M %P') %><br> <%= reservation.start_time.in_time_zone.strftime('%m/%d/%Y @ %l:%M %P') %><br>
<%= reservation.length %> minutes <%= reservation.length %> minutes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment