h1
  = @ip
  ' 's IP profile

ul
  li = link "View images this IP has uploaded", to: ~p"/search?#{[q: "ip:#{@ip}"]}"
  li = link "View comments this IP has posted", to: ~p"/comments?#{[cq: "ip:#{@ip}"]}"
  li = link "View posts this IP has made", to: ~p"/posts?#{[pq: "ip:#{@ip}"]}"

= render PhilomenaWeb.BanView, "_bans.html", bans: @subnet_bans, conn: @conn

h2 Administration Options
ul
  li
    => link "View tag changes", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes"
    = if ipv6?(@ip) do
      ' …
      = link "(/64)", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes?mask=64"
  li
    => link "View source URL history", to: ~p"/ip_profiles/#{to_string(@ip)}/source_changes"
    = if ipv6?(@ip) do
      ' …
      = link "(/64)", to: ~p"/ip_profiles/#{to_string(@ip)}/source_changes?mask=64"

  li = link "View reports this IP has made", to: ~p"/admin/reports?#{[rq: "ip:#{@ip}"]}"
  li = link "View IP ban history", to: ~p"/admin/subnet_bans?#{[ip: to_string(@ip)]}"
  li = link "Ban this sucker", to: ~p"/admin/subnet_bans/new?#{[specification: to_string(@ip)]}"

h2 Actions
ul
  li = link "Revert all tag changes", to: ~p"/tag_changes/full_revert?#{[ip: to_string(@ip)]}", data: [confirm: "Are you really, really sure?", method: "create"]
  li = link "...the button above didn't work (use carefully, this is resource-intensive)", to: ~p"/tag_changes/full_revert?#{[ip: to_string(@ip), batch_size: 1]}", data: [confirm: "Please confirm that you're aware that this may crash the site and are ready to take on the full wrath of the admins if it does so after you press this button.", method: "create"]

h4 Observed users
table.table
  thead
    tr
      th Username
      th Account Used
      th Last Seen
      th Created At
  tbody
    = for uip <- @user_ips do
      tr
        td
          = link uip.user.name, to: ~p"/profiles/#{uip.user}"
        td
          => uip.uses
          ' times
        td
          => pretty_time uip.updated_at
        td
          => pretty_time uip.user.created_at