Class: PagesController

Inherits:
ApplicationController show all
Defined in:
vendor/plugins/pages/app/controllers/pages_controller.rb

Instance Method Summary collapse

Methods inherited from Refinery::ApplicationController

#admin?, #error_404, #from_dialog?, #home_page?, #just_installed?, #local_request?, #wymiframe

Methods included from Crud

append_features

Instance Method Details

#homeObject



3
4
5
6
# File 'vendor/plugins/pages/app/controllers/pages_controller.rb', line 3

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

#showObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'vendor/plugins/pages/app/controllers/pages_controller.rb', line 8

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