-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html.erb
49 lines (45 loc) · 1.34 KB
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<div class="container">
<h2 class="page-header">Tickets</h2>
<%= form_tag tickets_path, method: :get do %>
<p>
<div class="input-group col-md-3">
<%= text_field_tag :search, params[:search], id: "search-box",
class: "form-control" %>
<span class="input-group-btn">
<%= submit_tag "Search", name: nil, id: "search-button",
class: "btn btn-primary" %>
</span>
</div>
</p>
<% end %>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Ticket</th>
<th>Created By</th>
<th>Resolved By</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<% @tickets.each do |ticket| %>
<tr id="ticket-<%= ticket.id %>" data-link="<%= ticket_path(ticket) %>"
class="<%= ticket_status_class(ticket) %>">
<td><%= ticket.id %></td>
<td><%= ticket.content %></td>
<td>
<%= ticket.users.select { |user| user.customer? }.first.email %>
</td>
<td>
<% if ticket.status == 'resolved' %>
<%= ticket.users.select { |user| user.agent? }.first.email %>
<% end %>
</td>
<td><%= ticket.status.capitalize %></td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @tickets %>
</div>