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.
orbit-4-1/app/controllers/pages_controller.rb

22 lines
659 B
Ruby

class PagesController < ApplicationController
Liquid::Template.register_filter(SnippetFilter)
def show
@page = Page.find(:first, :conditions => { :name => params[:page_name], :is_published => true })
if @page && @page.external_link
redirect_to @page.external_link
elsif @page
@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