cantino/huginn

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

Summary

Maintainability
Test Coverage
<div class='table-responsive'>
  <table class='table table-striped logs'>
    <tr>
      <th>Message</th>
      <th>When</th>
      <th width="200px"></th>
    </tr>

    <% @logs.each do |log| %>
      <tr>
        <td><%= truncate log.message, :length => 200, :omission => "..." %></td>
        <td><%= time_ago_in_words log.created_at %> ago</td>

        <td>
          <div class="btn-group btn-group-xs">
            <% if log.inbound_event.present? %>
              <%= link_to 'Event In', event_path(log.inbound_event), class: "btn btn-default" %>
            <% else %>
              <%= link_to 'Event In', '#', class: "btn btn-default disabled" %>
            <% end %>

            <% if log.outbound_event.present? %>
              <%= link_to 'Event Out', event_path(log.outbound_event), class: "btn btn-default" %>
            <% else %>
              <%= link_to 'Event Out', '#', class: "btn btn-default disabled" %>
            <% end %>

            <%= link_to 'Details', '#', :class => "btn btn-default show-log-details", :data => { :'modal-title' => log.level >= 4 ? 'Error' : 'Info', :'modal-content' => log.message } %>
          </div>
        </td>
      </tr>
    <% end %>
  </table>
</div>