MorningPeak/app/views/tickets/index.html.slim

42 lines
1.3 KiB
Plaintext

h1 Listing tickets
table.table.table-condensed.
thead
tr
td ID
th Creator
th Title
th Description
th State
th Last update
th Last response
th
th
th
th
tbody
- @tickets.each do |ticket|
tr class="#{ticket.admin_view_at.nil? ? 'bg-warning' : ''}"
td = link_to("##{ticket.id}", ticket)
td = link_to_creator(ticket)
td = link_to ticket.title, ticket
td = ticket.short_description
- if ticket.state == Ticket::CLOSE
td.bg-danger = ticket.state
- else
td.bg-success = ticket.state
td = ticket.updated_at.to_s(:long)
td = ticket.comments.empty? ? "never" : distance_of_time_in_words_to_now(ticket.comments.first.updated_at)
td = link_to 'Show', ticket
td = link_to 'Edit', edit_ticket_path(ticket)
td = link_to 'Destroy', ticket, data: {:confirm => 'Are you sure?'}, :method => :delete
- if ticket.open?
td = link_to 'Close', ticket_close_path(ticket), data: {:confirm => 'Are you sure?'}, :method => :patch
- elsif ticket.close?
td = link_to 'Reopen', ticket_open_path(ticket), data: {:confirm => 'Are you sure?'}, :method => :patch
br
= link_to 'New Ticket', new_ticket_path, class: 'btn btn-sm btn-default'