From 2c28058c68515e3984272d6537ffa6e903483ea3 Mon Sep 17 00:00:00 2001 From: Bruno Michel Date: Sun, 30 Oct 2011 14:18:20 +0100 Subject: [PATCH] Show abusers --- app/helpers/admin_helper.rb | 16 ++++++++++++++++ app/views/admin/_box.html.haml | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 app/helpers/admin_helper.rb diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb new file mode 100644 index 000000000..ae269b98a --- /dev/null +++ b/app/helpers/admin_helper.rb @@ -0,0 +1,16 @@ +module AdminHelper + + def abusers + file = Rails.root.join("tmp", "abusers.txt") + if File.exists?(file) + content_tag(:ul) do + safe_join File.readlines(file).map do |l| + content_tag(:li, l) + end + end + else + content_tag(:p, "aucun") + end + end + +end diff --git a/app/views/admin/_box.html.haml b/app/views/admin/_box.html.haml index 5767daa31..4be3f3770 100644 --- a/app/views/admin/_box.html.haml +++ b/app/views/admin/_box.html.haml @@ -1,3 +1,5 @@ #admin_box.box %h1 = link_to "Admin", '/admin' + %h2 Abusers + = abusers