This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
2009-05-07 17:18:16 +00:00
|
|
|
class PagesController < ApplicationController
|
|
|
|
|
2009-06-01 06:20:15 +00:00
|
|
|
def index
|
2011-04-13 10:19:51 +00:00
|
|
|
@page = Home.find_by_name('home')
|
2009-06-01 06:20:15 +00:00
|
|
|
if @page
|
2011-02-22 08:00:13 +00:00
|
|
|
render_page
|
2009-06-01 06:20:15 +00:00
|
|
|
else
|
|
|
|
render :text => 'You need a home page'
|
|
|
|
end
|
|
|
|
end
|
2009-05-07 18:13:27 +00:00
|
|
|
|
2011-01-31 07:58:28 +00:00
|
|
|
def show
|
|
|
|
begin
|
|
|
|
item = Item.first(:conditions => {:full_name => params[:page_name]})
|
|
|
|
case item._type
|
|
|
|
when 'Page'
|
|
|
|
@page = item
|
2011-02-22 08:00:13 +00:00
|
|
|
render_page
|
2011-01-31 07:58:28 +00:00
|
|
|
when 'Link'
|
|
|
|
redirect_to "http://#{item[:url]}"
|
|
|
|
end
|
|
|
|
rescue
|
|
|
|
render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
2011-04-13 10:19:51 +00:00
|
|
|
end
|
2009-05-07 17:18:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|