2009-05-07 17:18:16 +00:00
|
|
|
class PagesController < ApplicationController
|
|
|
|
|
2009-05-07 18:13:27 +00:00
|
|
|
Liquid::Template.register_filter(SnippetFilter)
|
|
|
|
|
2009-05-07 17:18:16 +00:00
|
|
|
def show
|
|
|
|
@page = Page.find_by_name(params[:page_name])
|
2009-05-07 17:54:33 +00:00
|
|
|
@layout = @page.layout
|
2009-05-07 17:18:16 +00:00
|
|
|
|
|
|
|
if @page
|
2009-05-07 17:54:33 +00:00
|
|
|
@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 )
|
2009-05-07 17:18:16 +00:00
|
|
|
else
|
|
|
|
render :text => '404 not found'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|