Module: Landable::PagesHelper

Defined in:
app/helpers/landable/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_pageObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/landable/pages_helper.rb', line 8

def current_page
  if params[:controller] == "landable/public/preview/page_revisions"
    current_page = PageRevision.find(params[:id])
  elsif params[:controller] == "landable/public/preview/pages"
    current_page = Page.find(params[:id])
  else
    current_page = Page.by_path(request.path)
  end

  @current_page ||= current_page
end

#landable(page = current_page) ⇒ Object



3
4
5
6
# File 'app/helpers/landable/pages_helper.rb', line 3

def landable(page = current_page)
  return Landable::NullPageDecorator.new if page.nil?
  @landable ||= Landable::PageDecorator.new(page)
end