Sha256: ea0a7b7e10d83a14d8c3db546a1a1f7f1404bd40710ce8af79060a835f91d9f2

Contents?: true

Size: 686 Bytes

Versions: 3

Compression:

Stored size: 686 Bytes

Contents

class PagesController < ApplicationController

  def home
    error_404 unless (@page = Page.find_by_link_url("/", :include => [:parts, :slugs])).present?
  end

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

    if @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 if first_live_child.present?
      end
    else
      error_404
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.6.33 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.6.32 vendor/plugins/pages/app/controllers/pages_controller.rb