0
0
Fork 0

- changed the login path to /login

- added the posts view in the admin panel
This commit is contained in:
Gibheer 2011-07-01 14:14:02 +02:00
parent 63c0d87b6f
commit b0f80f3b9a
3 changed files with 12 additions and 5 deletions

View File

@ -4,7 +4,7 @@ class Admin < Sinatra::Base
use Rack::Flash, :accessorize => [:error, :warning, :notice]
set :haml, :layout => :admin_layout
get '/index' do
get '/' do
haml :admin_index
end
@ -61,7 +61,7 @@ class Admin < Sinatra::Base
end
end
get '/' do
get '/login' do
haml :admin_index_no_login
end
@ -118,11 +118,11 @@ class Admin < Sinatra::Base
@account = session_read
end
before %r{^(?!\/(login|stylesheet\.css)?$)} do
before %r{^(?!\/(login|stylesheet\.css)+$)} do
if @account.nil?
flash.warning = 'You are not logged in!'
session[:to_path] = request.path_info
redirect '/admin'
redirect '/admin/login'
else
session[:last_updated] = Time.now
end

7
views/admin_posts.haml Normal file
View File

@ -0,0 +1,7 @@
-@posts.each do |post|
.post
.title
%a{:href => "/admin/post/#{post.id}"}=post.title
%span.released{:class => "post-released-#{post.released}"}
.written=post.written
.content=post.content

View File

@ -9,7 +9,7 @@
%h1="zero-knowledge.org"
#content
%p.hint
%a{:href => '/admin'}='Adminpanel'
%a{:href => '/admin/login'}='Adminpanel'
=yield
%footer#footer="ein footer"
:javascript