summaryrefslogtreecommitdiff
path: root/app/views/intruders
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/intruders')
-rw-r--r--app/views/intruders/_form_core.html.haml4
-rw-r--r--app/views/intruders/_index_core.html.haml25
-rw-r--r--app/views/intruders/index.html.haml9
3 files changed, 22 insertions, 16 deletions
diff --git a/app/views/intruders/_form_core.html.haml b/app/views/intruders/_form_core.html.haml
index 780d8cd..a0c2eb0 100644
--- a/app/views/intruders/_form_core.html.haml
+++ b/app/views/intruders/_form_core.html.haml
@@ -1,5 +1,7 @@
.inputs
= f.input :list_type, :collection => Intruder::LIST_TYPES, :label => t('intruders.form.list_type.label'), :hint => conditional_hint('intruders.form.list_type.hint'), :include_blank => false
= f.input :contact_ip, :label => t('intruders.form.contact_ip.label'), :hint => conditional_hint('intruders.form.contact_ip.hint')
- = f.input :ban_end, :label => t('intruders.form.ban_end.label'), :hint => conditional_hint('intruders.form.ban_end.hint')
+ = f.input :points, :label => t('intruders.form.points.label'), :hint => conditional_hint('intruders.form.points.hint')
+ = f.input :bans, :label => t('intruders.form.bans.label'), :hint => conditional_hint('intruders.form.bans.hint'), as: :boolean
+
= f.input :comment, :label => t('intruders.form.comment.label'), :hint => conditional_hint('intruders.form.comment.hint')
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
index 63f2253..1fca601 100644
--- a/app/views/intruders/_index_core.html.haml
+++ b/app/views/intruders/_index_core.html.haml
@@ -2,38 +2,39 @@
%tr
%th
%th= t('intruders.index.contact_ip')
- %th= t('intruders.index.contact_port')
%th= t('intruders.index.points')
- %th= t('intruders.index.bans')
%th= t('intruders.index.ban_last')
- %th= t('intruders.index.ban_end')
%th= t('intruders.index.contact_count')
%th= t('intruders.index.contact_last')
%th= t('intruders.index.contacts_per_second')
%th= t('intruders.index.user_agent')
%th= t('intruders.index.to_user')
+ %th
- for intruder in intruders
- %tr
+ - if intruder.list_type == 'whitelist'
+ - entry_class = 'success'
+ - elsif intruder.bans.to_i > 0
+ - entry_class = 'error'
+ - elsif intruder.points.to_i > 0
+ - entry_class = 'warn'
+ - else
+ - entry_class = ''
+ %tr{:class => "table #{entry_class}"}
%td
- - if intruder.list_type == 'whitelist'
+ - if entry_class == 'success'
%i.icon-ok
- - elsif intruder.bans > 0
+ - elsif entry_class == 'error'
%i.icon-fire
- - elsif intruder.points > 0
+ - elsif entry_class == 'warn'
%i.icon-warning-sign
%td= intruder.contact_ip
- %td= intruder.contact_port
%td= intruder.points
- %td= intruder.bans
%td
- if intruder.ban_last
= l intruder.ban_last, :format => :short
- %td
- - if intruder.ban_end
- = l intruder.ban_end, :format => :short
%td= intruder.contact_count
%td
diff --git a/app/views/intruders/index.html.haml b/app/views/intruders/index.html.haml
index 72b8882..79b4ceb 100644
--- a/app/views/intruders/index.html.haml
+++ b/app/views/intruders/index.html.haml
@@ -1,6 +1,9 @@
- content_for :title, t("intruders.index.page_title")
-- if @intruders && @intruders.count > 0
- = render "index_core", :intruders => @intruders
+- if @intruders && @intruders.count > 0 && @list_types && @list_types.count > 0
+ - @list_types.each do |list_type|
+ %h3= list_type
+ %table.table.table-striped
+ = render "index_core", :intruders => @intruders.where(:list_type => list_type)
-= render :partial => 'shared/create_link', :locals => {:child_class => Intruder} \ No newline at end of file
+= render :partial => 'shared/create_link', :locals => {:child_class => Intruder}