added admin part with password protected map and supporter list UNTESTED

This commit is contained in:
2016-04-18 08:45:50 +02:00
parent 2108e4435e
commit 52a98021d2
6 changed files with 40 additions and 1 deletions
@@ -0,0 +1,3 @@
class Admin::ApplicationController < ApplicationController
http_basic_authenticate_with name: "admin", password: ENV['ADMIN_PASSWORD'] unless Rails.env.development?
end
@@ -0,0 +1,5 @@
class Admin::PagesController < Admin::ApplicationController
def map
@supporters = Supporter.where(:coordinates.ne => nil).only(:coordinates, :support)
end
end
@@ -0,0 +1,5 @@
class Admin::SupportersController < Admin::ApplicationController
def index
@supporters = Supporter.desc(:created_at)
end
end
+21
View File
@@ -0,0 +1,21 @@
h1 #{@supporters.count} Unterstützer
table.table
tr
th Eingeschrieben
th Adresse
th Unterstützung
th width="20%" Kommentar
- @supporters.each do |supporter|
tr
td = distance_of_time_in_words_to_now(supporter.created_at)
td
address
= "#{supporter.first_name} #{supporter.last_name}"
=
br
= supporter.street
br
= "#{supporter.zip} #{supporter.city}"
td = supporter.support
td = supporter.comments
+6 -1
View File
@@ -5,5 +5,10 @@ Rails.application.routes.draw do
get '/thanks', to: 'pages#thanks', as: :thanks
get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete
get '/map', to: 'pages#map', as: :map
namespace :admin do
get '/map', to: 'pages#map', as: :map
resources :supporters, only: :index
end
end