From de6abb94d05f8c36a1d4efa371f34ad620f191c2 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 31 May 2013 14:35:18 +0200 Subject: country added --- app/models/intruder.rb | 4 ++++ app/views/intruders/_index_core.html.haml | 2 ++ app/views/intruders/show.html.haml | 3 +++ 3 files changed, 9 insertions(+) (limited to 'app') diff --git a/app/models/intruder.rb b/app/models/intruder.rb index 9c01634..c305bd3 100644 --- a/app/models/intruder.rb +++ b/app/models/intruder.rb @@ -25,6 +25,10 @@ class Intruder < ActiveRecord::Base key end + def country + GeoIpCountry.find_by_ip(self.contact_ip) + end + def whois(ip_address = self.contact_ip) if ! ip_address.blank? begin diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml index 1fca601..fa1cf8f 100644 --- a/app/views/intruders/_index_core.html.haml +++ b/app/views/intruders/_index_core.html.haml @@ -2,6 +2,7 @@ %tr %th %th= t('intruders.index.contact_ip') + %th= t('intruders.index.country') %th= t('intruders.index.points') %th= t('intruders.index.ban_last') %th= t('intruders.index.contact_count') @@ -31,6 +32,7 @@ %i.icon-warning-sign %td= intruder.contact_ip + %td= intruder.country %td= intruder.points %td - if intruder.ban_last diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml index df50872..5096941 100644 --- a/app/views/intruders/show.html.haml +++ b/app/views/intruders/show.html.haml @@ -21,6 +21,9 @@ %p %strong= t('intruders.show.contact_ip') + ":" = @intruder.contact_ip +%p + %strong= t('intruders.show.country') + ":" + = @intruder.country %p %strong= t('intruders.show.contact_port') + ":" = @intruder.contact_port -- cgit v1.2.3