Sha256: 17c4748107d4911d8cf9e6d41e5f6459806daa9d24f5e28302efe18fe4e2ce64
Contents?: true
Size: 1.45 KB
Versions: 9
Compression:
Stored size: 1.45 KB
Contents
class PagesController < ApplicationController caches_action :home, :show, :cache_path => Proc.new { |c| "#{c.request.host_with_port}/views/pages/#{c.params[:path]}" }, :if => Proc.new { |c| c.send(:logged_in?) == false and (!RefinerySetting.table_exists? || RefinerySetting.find_or_set(:page_caching_enabled, true, :scoping => 'pages')) } def home error_404 unless (@page = Page.find_by_link_url("/", :include => [:parts, :slugs])).present? end # This action can be accessed normally, or as nested pages. # Assuming a page named "mission" that is a child of "about", # you can access the pages with the following URLs: # # GET /pages/about # GET /about # # GET /pages/mission # GET /about/mission # def show @page = if params[:path] Page.find(params[:path].last, :include => [:parts, :slugs]) else Page.find(params[:id], :include => [:parts, :slugs]) end if @page.try(:live?) or (logged_in? and current_user.authorized_plugins.include?("Pages")) # if the admin wants this to be a "placeholder" page which goes to its first child, go to that instead. if @page.skip_to_first_child first_live_child = @page.children.find_by_draft(false, :order => "position ASC") redirect_to first_live_child.url if first_live_child.present? end else error_404 end end end
Version data entries
9 entries across 9 versions & 1 rubygems