Sha256: 26682a185041dfc79e9174eae52a7702f1d49d2c7c03d3a50906b425b213b075

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 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

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-0.9.6.31 vendor/plugins/pages/app/controllers/pages_controller.rb
refinerycms-0.9.6.30 vendor/plugins/pages/app/controllers/pages_controller.rb