Convert index tables to using table builder

This commit is contained in:
BrokenEagle
2020-01-03 06:19:30 +00:00
parent 917ffa87ed
commit 043944e1dd
47 changed files with 1161 additions and 1628 deletions

View File

@@ -1,32 +1,24 @@
<table class="striped autofit">
<thead>
<tr>
<th>Source</th>
<th>ID</th>
<th>IP Address</th>
<th>User</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td><%= link_to ip.model_type.underscore.humanize, ip_addresses_path(search: { model_type: ip.model_type }) %></td>
<td><%= link_to "##{ip.model_id}", ip.model %></td>
<td>
<%= link_to ip.ip_addr, ip_addresses_path(search: { ip_addr: ip.ip_addr }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.ip_addr, group_by: "user" }) %>
</td>
<td>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
</td>
<td><%= time_ago_in_words_tagged ip.created_at %></td>
<td><%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "Source" do |ip| %>
<%= link_to ip.model_type.underscore.humanize, ip_addresses_path(search: { model_type: ip.model_type }) %>
<% end %>
<% t.column "ID" do |ip| %>
<%= link_to "##{ip.model_id}", ip.model %>
<% end %>
<% t.column "IP Address" do |ip| %>
<%= link_to ip.ip_addr, ip_addresses_path(search: { ip_addr: ip.ip_addr }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.ip_addr, group_by: "user" }) %>
<% end %>
<% t.column "User" do |ip| %>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
<% end %>
<% t.column "Date" do |ip| %>
<%= time_ago_in_words_tagged ip.created_at %>
<% end %>
<% t.column "" do |ip| %>
<%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %>
<% end %>
<% end %>
<%= numbered_paginator(@ip_addresses) %>

View File

@@ -2,24 +2,15 @@
<%= link_to "Find all users associated with the top 10 IP addresses", ip_addresses_path(search: { ip_addr: @ip_addresses.map(&:to_s).take(10).join(" "), group_by: "user" }) %>
</p>
<table class="striped autofit">
<thead>
<tr>
<th>IP Address</th>
<th>Uses</th>
<th></th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td>
<%= link_to ip.to_s, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.to_s, group_by: "user" }) %>
</td>
<td><%= link_to ip.count_all, ip_addresses_path(search: { ip_addr: ip.to_s }) %></td>
<td><%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "IP Address" do |ip| %>
<%= link_to ip.to_s, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<%= link_to "»", ip_addresses_path(search: { ip_addr: ip.to_s, group_by: "user" }) %>
<% end %>
<% t.column "Uses" do |ip| %>
<%= link_to ip.count_all, ip_addresses_path(search: { ip_addr: ip.to_s }) %>
<% end %>
<% t.column "" do |ip| %>
<%= link_to "IP info", "https://ipinfo.io/#{ip.ip_addr}" %>
<% end %>
<% end %>

View File

@@ -2,22 +2,13 @@
<%= link_to "Find all IP addresses associated with these users", ip_addresses_path(search: { user_id: @ip_addresses.map(&:user_id).join(" "), group_by: "ip_addr" }) %>
</p>
<table class="striped autofit">
<thead>
<tr>
<th>User</th>
<th>Uses</th>
</tr>
</thead>
<tbody>
<% @ip_addresses.each do |ip| %>
<tr>
<td>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
</td>
<td><%= link_to ip.count_all, ip_addresses_path(search: { user_id: ip.user_id, ip_addr: params[:search][:ip_addr] }) %></td>
</tr>
<% end %>
</tbody>
</table>
<%= table_for @ip_addresses, {class: "striped autofit"} do |t| %>
<% t.column "User" do |ip| %>
<%= link_to_user ip.user %>
<%= link_to "»", ip_addresses_path(search: { user_id: ip.user_id, group_by: "ip_addr" }) %>
<% end %>
<% t.column "Uses" do |ip| %>
<%= link_to ip.count_all, ip_addresses_path(search: { user_id: ip.user_id, ip_addr: params[:search][:ip_addr] }) %>
<% end %>
<% end %>