space_home.erb 5.32 KB
Newer Older
Tyler Lemburg's avatar
Tyler Lemburg committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<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>
Tyler Lemburg's avatar
Tyler Lemburg committed
15
            <th>Resource</th>
Tyler Lemburg's avatar
Tyler Lemburg committed
16
17
18
19
20
21
22
23
24
25
26
27
            <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 %>
28
29
30
                <% unless reservation.title.nil? || reservation.title.empty? %>
                    <br><small><%= reservation.title %></small>
                <% end %>
Tyler Lemburg's avatar
Tyler Lemburg committed
31
32
33
34
35
36
            </td>
            <td>
            	<%= reservation.start_time.in_time_zone.strftime('%m/%d/%Y @ %l:%M %P') %><br>
            	<%= reservation.length %> minutes
            </td>
            <td class="table-actions">
37
                <a href="<%= reservation.download_link %>" class="wdn-button wdn-button-triad">Download</a>
Tyler Lemburg's avatar
Tyler Lemburg committed
38
39
40
41
                <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>
42
43
44
45
46
                <% unless reservation.recurring_reference_id.nil? %>
                <form method="POST" action="/<%= @space.url_name %>/resources/<%= reservation.resource.id %>/cancel_all/<%= reservation.recurring_reference_id %>/" class="delete-form delete-recurring-reservation">
                    <button class="wdn-button" type="submit">Remove All</button>
                </form>
                <% end %>
Tyler Lemburg's avatar
Tyler Lemburg committed
47
48
49
50
51
            </td>
        </tr>
    <% end %>
    </tbody>
</table>
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<% if total_pages > 1 %>
<script>
    WDN.loadCSS(WDN.getTemplateFilePath('css/modules/pagination.css'));
</script>
<div style="text-align: center;">
    <div style="display: inline-block;">
        <ul class="wdn_pagination" data-tab="pending" style="padding-left: 0;">
            <% if page != 1 %>
                <li class="arrow prev"><a href="?page=<%= page-1 %>" title="Go to the previous page">← prev</a></li>
            <% end %>
            <% before_ellipsis_shown = false; after_ellipsis_shown = false %>
            <% (1..total_pages).each do |i| %>
                    <% if i == page %>
                        <li class="selected"><span><%= i %></span></li>
                    <% elsif (i <= 3 || i >= total_pages - 2 || i == page - 1 || 
                                i == page - 2 || i == page + 1 || $i == page + 2) %>
                        <li><a href="?page=<%= i %>" title="Go to page <%= i %>"><%= i %></a></li>
                    <% elsif (i < page && !before_ellipsis_shown) %>
                        <li><span class="ellipsis">...</span></li>
                        <% before_ellipsis_shown = true %>
                    <% elsif (i > page && !after_ellipsis_shown) %>
                        <li><span class="ellipsis">...</span></li>
                        <% after_ellipsis_shown = true %>
                    <% end %>
            <% end %>
            <% if page != total_pages %>
                <li class="arrow next"><a href="?page=<%= page+1 %>" title="Go to the next page">next →</a></li>
            <% end %>
        </ul>
    </div>
</div>
<% end %>

Tyler Lemburg's avatar
Tyler Lemburg committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<% 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">
113
114
                <a href="<%= event.download_link %>" class="wdn-button wdn-button-triad">Download</a>
            	<form action="/<%= @space.url_name %>/events/<%= event.id %>/remove_signup/" method="POST" class="delete-form">
Tyler Lemburg's avatar
Tyler Lemburg committed
115
116
117
118
119
120
121
122
123
					<button class="wdn-button" type="submit">
					Remove
					</button>
				</form>
            </td>
        </tr>
    <% end %>
    </tbody>
</table>
124
125
126
127
128
129
130
131
132
133
134
135
136
<% end %>

<script type="text/javascript">
require(['jquery'], function($) {
    $(document).ready(function() {
        $('.delete-recurring-reservation').submit(function (submit) {
            if (!window.confirm('This will remove all recurrences of this reservation. Are you sure?')) {
                submit.preventDefault();
            }
        });
    });
});
</script>