app/views/dashboards/index.html.erb
<div class="container">
<h1>Events</h1>
</div>
<div class="container">
<% if @events.any? %>
<table class="dashboard-table table-borderless mb-3" id="events" tabindex="0">
<thead>
<tr>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col">Title</th>
<th scope="col">Attendee Count</th>
<th scope="col">Last Use</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<% @events.each do |event| %>
<tr id="event row">
<td>
<%= button_to 'Event Check-in', event_path(event.id), method: :get, :class => 'btn btn-yale' %>
</td>
<td>
<%= button_to 'Attendee List', event_attendances_path(event.id), method: :get, :class => 'btn btn-primary ' %>
</td>
<td>
<%= event.title %>
</td>
<td>
<%= event.attendances.size %>
</td>
<td>
<%= event.updated_at.strftime('%Y-%m-%d %I:%M %p') %>
</td>
<td>
<%= button_to 'Edit Event', edit_event_path(event.id), method: :get, :class => 'btn btn-primary' %>
</td>
<td>
<%= button_to 'X', event_path(event.id), method: :delete, data: { confirm: 'Are you sure? This action cannot be undone.'}, :class => 'btn btn-danger btn-sm', aria: { label: 'Delete Event' } %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class='d-flex justify-content-center'><%= paginate(@events) %></div>
<% else %>
<div class='d-flex justify-content-center'><h2>No events!</h2></div>
<% end %>
</div>