<div id="c-user-sessions">
  <div id="a-index">
    <%= search_form_for(user_sessions_path) do |f| %>
      <%= f.input :session_id, label: "Session", input_html: { value: params[:search][:session_id] } %>
      <%= f.input :ip_addr, label: "IP Address", input_html: { value: params[:search][:ip_addr] } %>
      <%= f.submit "Search" %>
    <% end %>

    <%= table_for @user_sessions, class: "striped autofit" do |t| %>
      <% t.column "Session" do |user_session| %>
        <%= link_to user_session.session_id, user_sessions_path(search: { session_id: user_session.session_id }) %>
        <%= link_to "»", user_events_path(search: { user_session: { session_id: user_session.session_id }}) %>
      <% end %>

      <% t.column "IP Address" do |user_session| %>
        <%= link_to user_session.ip_addr, user_sessions_path(search: { ip_addr: user_session.ip_addr }) %>
        <%= link_to "»", user_events_path(search: { user_session: { ip_addr: user_session.ip_addr }}) %>
      <% end %>

      <% t.column "Browser" do |user_session| %>
        <%= user_session.user_agent %>
      <% end %>

      <% t.column "Created" do |user_session| %>
        <%= time_ago_in_words_tagged(user_session.created_at) %>
      <% end %>
    <% end %>

    <%= numbered_paginator(@user_sessions) %>
  </div>
</div>
