only logged in users can make pages
parent
ae18d70f66
commit
df7e487041
|
@ -1,4 +1,6 @@
|
||||||
class Pages < Application
|
class Pages < Application
|
||||||
|
before :logged_in?, :only => [ :new, :edit, :create, :update, :delete ]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@pages = Page.find :all, :order => 'name ASC', :conditions => [ 'published = ?', false ]
|
@pages = Page.find :all, :order => 'name ASC', :conditions => [ 'published = ?', false ]
|
||||||
@secondary_title = 'Wiki Pages. En Masse.'
|
@secondary_title = 'Wiki Pages. En Masse.'
|
||||||
|
@ -8,8 +10,10 @@ class Pages < Application
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@page = Page.find_by_name(params[:id].gsub(/_/, ' '))
|
@page = Page.find_by_name(params[:id].gsub(/_/, ' '))
|
||||||
if @page.nil?
|
if @page.nil? and logged_in?
|
||||||
redirect url(:new_page, :new_name => params[:id])
|
redirect url(:new_page, :new_name => params[:id])
|
||||||
|
elsif @page.nil?
|
||||||
|
raise NotFound
|
||||||
else
|
else
|
||||||
@comments = @page.comments
|
@comments = @page.comments
|
||||||
@secondary_title = @page.name
|
@secondary_title = @page.name
|
||||||
|
|
Reference in New Issue