Arie/serveme

View on GitHub
app/views/league_requests/index.html.haml

Summary

Maintainability
Test Coverage
%h2= "#{@results.size} search results"

.row
  .col-md-12
    %table.table.table-condensed
      %thead
        %tr
          %th Reservation ID
          %th Start time
          %th End time
          %th IP
          %th Name
          %th Steam ID
          %th ETF2L
          %th RGL.gg
          %th OZF
          %th logs.tf
      - @results.each do |result|
        %tr
          %td= link_to(result.reservation_id, show_reservation_statistic_path(reservation_id: result.reservation_id))
          %td= I18n.l(result.reservation.starts_at, format: :long)
          %td= I18n.l(result.reservation.ends_at, format: :time_without_seconds)
          %td
            - if result.ip.present?
              - if asn = @asns[result.ip]
                = link_to(result.ip, league_request_path(ip: result.ip), class: "asn-tooltip", data: {toggle: "tooltip", html: true, placement: "top"}, title: render("asn_tooltip", asn: asn))
                - if ReservationPlayer.banned_ip?(result.ip)
                  %span.badge.badge-danger{title: "Banned IP"}
                    %i.fa 💀
                - if ReservationPlayer.banned_asn?(asn)
                  %span.badge.badge-warning{title: "Possible VPN"}
                    %i.fa.fa-flag
              - else
                = link_to(result.ip, league_request_path(ip: result.ip))
          %td= result.name
          %td
            = link_to(result.steam_uid, league_request_path(steam_uid: result.steam_uid))
            - if ReservationPlayer.banned_uid?(result.steam_uid)
              %span.badge.badge-danger{title: "Banned Steam ID"}
                %i.fa 💀
          %td= link_to("ETF2L", "http://etf2l.org/search/#{result.steam_uid}/")
          %td= link_to("RGL", "http://rgl.gg/Public/PlayerProfile.aspx?p=#{result.steam_uid}")
          %td= link_to("OZF", "https://ozfortress.com/users/steam_id/#{result.steam_uid}")
          %td= link_to("logs.tf", "http://logs.tf/profile/#{result.steam_uid}")

= link_to league_request_path do
  .btn.btn-primary
    New search

:javascript
  $('.asn-tooltip').tooltip();