denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyCMS/app/views/shinycms/admin/web_stats/index.html.erb

Summary

Maintainability
Test Coverage
<%= render partial: 'admin/includes/search', locals: { placeholder: t( '.search' ), action: shinycms.search_web_stats_path } %>

<% if @visits.present? %>
<table class="table table-responsive-sm table-striped">
  <thead>
    <tr>
      <th colspan="2">
        Visit started
      </th>
      <th>
        IP address
      </th>
      <th>
        Username
      </th>
      <th>
        Landing page
      </th>
    </tr>
  </thead>

  <tbody>
    <% @visits.each do |visit| %>
    <tr>
    <td class="width5pc">
        <%= display_time( visit.started_at ) %>
      </td>
      <td>
        <%= display_date( visit.started_at ) %>
      </td>
      <td>
        <%= visit.ip %>
      </td>
      <td>
        <% if visit.user_id %><%= link_to visit.user.username, user_web_stats_path( visit.user ) %><% end %>
      </td>
      <td>
        <%= visit.landing_page %>
      </td>
    </tr>
    <% end %>
  </tbody>
</table>
<% end %>

<%= render partial: 'admin/includes/pager', locals: { pagy: @pagy, name: @visits.name } %>