Skip to content
Snippets Groups Projects
space_home.erb 2.59 KiB
<div id="pagetitle">
	<h3>Welcome to <%= @space.name %> Resource Scheduler<span class="wdn-subhead">Hello, <%= @user.full_name %></span></h3>
</div>

<h4>
My Reservations
</h4>
<% if reservations.empty? %>
You have no upcoming reservations. You can view upcoming trainings to get certified, or check out the list of resources you can reserve.<br>
<a href="<%= @space.resources_href %>" class="wdn-button wdn-button-brand">View Resources</a>
<% else %>
<table>
    <thead>
        <tr>
            <th>Resource</th>
            <th>Time</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
    <% reservations.each do |reservation| %>
        <tr>
            <td>
                <%= reservation.resource.name %>
                <% if !reservation.event.nil? %>
                    <br><small><%= reservation.event.title %></small>
                <% end %>
            </td>
            <td>
            	<%= reservation.start_time.in_time_zone.strftime('%m/%d/%Y @ %l:%M %P') %><br>
            	<%= reservation.length %> minutes
            </td>
            <td class="table-actions">
                <a href="/<%= @space.url_name %>/resources/<%= reservation.resource.id %>/edit_reservation/<%= reservation.id %>/" class="wdn-button wdn-button-brand">Edit</a>
                <form method="POST" action="/<%= @space.url_name %>/resources/<%= reservation.resource.id %>/cancel/<%= reservation.id %>/" class="delete-form">
                    <button class="wdn-button" type="submit">Remove</button>
                </form>
            </td>
        </tr>
    <% end %>
    </tbody>
</table>
<% end %>

<h4>
My Events
</h4>
<% if events.empty? %>
You have not signed up for any upcoming events. Why not check out the calendar to find some?<br>
<a href="<%= @space.calendar_href %>" class="wdn-button wdn-button-triad">View Calendar</a>
<% else %>
<table>
    <thead>
        <tr>
            <th>Title</th>
            <th>Date/Location</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
    <% events.each do |event| %>
        <tr>
            <td>
                <a href="<%= event.info_link %>"><%= event.title %></a>
            </td>
            <td>
                <%= event.start_time.in_time_zone.strftime('%m/%d/%Y @ %l:%M %P') %><br>
                <%= event.location.name %>
            </td>
            <td class="table-actions">