- changed the login path to /login
- added the posts view in the admin panel
This commit is contained in:
parent
63c0d87b6f
commit
b0f80f3b9a
8
admin.rb
8
admin.rb
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue