orbit-basic/app/controllers/pages_controller.rb

25 lines
814 B
Ruby
Raw Normal View History

class PagesController < ApplicationController
Liquid::Template.register_filter(SnippetFilter)
def show
2009-05-22 07:16:22 +00:00
@page = Page.find(:first, :conditions => { :name => params[:page_name], :is_published => true })
2009-06-01 02:54:16 +00:00
if @page && !@page.external_link.blank?
2009-05-22 06:51:32 +00:00
redirect_to @page.external_link
2009-06-01 02:54:16 +00:00
elsif @page && @page.use_engine
#model_class = Kernel.const_get( "Announcement" ) # page.use_engine
redirect_to announcements_path
2009-05-22 06:51:32 +00:00
elsif @page
2009-05-22 07:16:22 +00:00
@layout = @page.layout
@page_content = Liquid::Template.parse(@page.content).render
@layout_content = (@page.layout)? @layout.content : "{{page_content}}"
render :text => Liquid::Template.parse(@layout_content).render( 'page_content' => @page_content )
else
render :text => '404 not found'
end
end
end