Class: Refinery::PagesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Refinery::Pages::RenderOptions
Defined in:
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
# File 'app/controllers/refinery/pages_controller.rb', line 12

def home
  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


26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/refinery/pages_controller.rb', line 26

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