Module: PagesControllerSite

Defined in:
lib/refinerycms-multisite.rb

Instance Method Summary collapse

Instance Method Details

#home_with_siteObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/refinerycms-multisite.rb', line 54

def home_with_site
  if (@site)
    @page = Page.find(@site.page_id)
    if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?("refinery_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.order('lft ASC').live.first).present?
        redirect_to first_live_child.url
      elsif @page.link_url.present?
        redirect_to @page.link_url and return
      end
    else
      error_404
    end
  else
    home_without_site
  end
end