Module: Refinery::Pages::ContentPagesHelper

Defined in:
app/helpers/refinery/pages/content_pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#refinery_menu_pagesObject

Compiles the default menu.



26
27
28
# File 'app/helpers/refinery/pages/content_pages_helper.rb', line 26

def refinery_menu_pages
  Refinery::Menu.new Refinery::Page.fast_menu
end

#render_content_page(page, options = {}) ⇒ Object

Build the html for a Refinery CMS page object by creating a ContentPagePresenter. This is a specialised type of ContentPresenter, so the object is then passed to render_content_presenter to get its html. The options are passed to that method, so see render_content_presenter for more details.



8
9
10
11
# File 'app/helpers/refinery/pages/content_pages_helper.rb', line 8

def render_content_page(page, options = {})
  content_page_presenter = Refinery::Pages::ContentPagePresenter.new(page, page_title)
  render_content_presenter(content_page_presenter, options)
end

#render_content_presenter(content_page, options = {}) ⇒ Object

Pass the options into a ContentPresenter object and return its html. For more details see Refinery::Pages::ContentPresenter (and its subclasses). This method also checks for template overrides. Any template rendered by the current action may specify content_for a section using the section’s id. For this reason, sections should not have an ID which you would normally be using for content_for, so avoid common layout names such as :header, :footer, etc.



19
20
21
22
23
# File 'app/helpers/refinery/pages/content_pages_helper.rb', line 19

def render_content_presenter(content_page, options = {})
  content_page.hide_sections(options[:hide_sections]) if options[:hide_sections]
  content_page.fetch_template_overrides { |section_id| content_for(section_id)}
  content_page.to_html(options[:can_use_fallback])
end