Orbit/app/controllers/pages_controller.rb

28 lines
572 B
Ruby
Raw Normal View History

class PagesController < ApplicationController
def index
@item = Page.find_by_name('home')
if @item
2011-02-22 08:00:13 +00:00
render_page
else
render :text => 'You need a home page'
end
end
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'
@item = 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
end
end
end