rails-engine/exception-track

View on GitHub
app/views/exception_track/logs/index.html.erb

Summary

Maintainability
Test Coverage
<script type="text/javascript">
  function confirmDestroyAll() {
    if (!confirm('Are you sure want destroy all Exception logs?')) {
      return false;
    }
  }
</script>
<div class="toolbar">
  <a class="btn" href="/">Back to App</a>

  <div class="pull-right">
    <%= form_tag(export_logs_path, method: 'post') do %>
      <button type="submit" class="btn">Export last 3 months</button>
    <% end %>
    <%= form_tag(all_logs_path, method: 'delete') do %>
      <button type="submit" class="btn btn-danger" onclick="return confirmDestroyAll()">Delete All</button>
    <% end %>
  </div>
</div>

<% if @logs.blank? %>
  <div class="no-record">No exceptions.</div>
<% else %>
  <h1><%= pluralize(@logs.total_count, 'exception') %></h1>
  <%= paginate @logs %>

  <table class="table table-borded tabl">
    <thead>
      <tr>
        <th>#</th>
        <th>Summary</th>
        <th class="date"></th>
      </tr>
    </thead>

    <tbody>
      <% @logs.each do |log| %>
        <tr>
          <td><%= log.id %></td>
          <td><%= link_to log.title, log %></td>
          <td class="date"><%= log.created_at.to_s %></td>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= paginate @logs %>
<% end %>