Sha256: 8a4deb559da381018ec44c7de400e9a4844a9528632f8d991e591b78c0d06616

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

class PagesController < ApplicationController

  def home
    @page = Page.find_by_link_url("/", :include => [:parts, :slugs])
    error_404 if @page.nil?
    
    respond_to do |wants|
      wants.html
    end
  end

  def show
    @page = Page.find(params[:id], :include => [:parts, :slugs])

    error_404 unless @page.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 unless first_live_child.nil?
    else    
      respond_to do |wants|
        wants.html
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.5.12 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.5.11 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.5.10 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.5.9 vendor/plugins/pages/app/controllers/pages_controller.rb