Class: Refinery::PagesController

Inherits:
ApplicationController show all
Includes:
Refinery::Pages::RenderOptions
Defined in:
pages/app/controllers/refinery/pages_controller.rb

Defined Under Namespace

Modules: Finders

Instance Method Summary collapse

Instance Method Details

#homeObject

This action is usually accessed with the root path, normally ‘/’



12
13
14
15
16
17
# File 'pages/app/controllers/refinery/pages_controller.rb', line 12

def home
  if page.link_url.present? && page.link_url != "/"
    redirect_to page.link_url, status: 301 and return
  end
  render_with_templates?
end

#showObject

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


29
30
31
32
33
34
35
36
37
38
39
# File 'pages/app/controllers/refinery/pages_controller.rb', line 29

def show
  if should_skip_to_first_child?
    redirect_to refinery.url_for(first_live_child.url), status: 301 and return
  elsif page.link_url.present?
    redirect_to page.link_url, status: 301 and return
  elsif should_redirect_to_friendly_url?
    redirect_to refinery.url_for(page.url), status: 301 and return
  end

  render_with_templates?
end