Sha256: f6eeadc1f9f4aa5fbbb8c165f4b2358179e8780c2986f0b2abff68489cc892e6

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

class PagesController < ApplicationController
	caches_action :show, :if => Proc.new { |c| Spud::Cms.enable_full_page_caching }
	def show
		url_name = !params[:id].blank? ? params[:id] : Spud::Cms.root_page_name
		@page = SpudPage.published_pages.where(:url_name => url_name).includes([:spud_template,:spud_page_partials]).first
		if @page.blank?
			flash[:error] = "Page not found"
			if !params[:id].blank?
				redirect_to root_url() and return
			else
				return
			end
		end
		if @page.is_private?
			before_filter :require_user
		end
		layout = Spud::Cms.default_page_layout


		if !@page.spud_template.blank?
			if !@page.spud_template.base_layout.blank?
				layout = @page.spud_template.base_layout
			end
			@inline = @page.spud_template.content
			
		end
		render :layout => layout
		
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spud_cms-0.4.5 app/controllers/pages_controller.rb
spud_cms-0.4.4 app/controllers/pages_controller.rb