Module: EffectivePageSectionsHelper

Defined in:
app/helpers/effective_page_sections_helper.rb

Instance Method Summary collapse

Instance Method Details

#effective_page_sectionsObject



5
6
7
# File 'app/helpers/effective_page_sections_helper.rb', line 5

def effective_page_sections
  @_effective_page_sections ||= Effective::PageSection.deep.all
end

#render_page_section(name, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/effective_page_sections_helper.rb', line 9

def render_page_section(name, &block)
  raise('expected a name') unless name.present?

  name = name.to_s

  page_section = effective_page_sections.find { |ps| ps.name == name }
  return if page_section.blank?

  if block_given?
    yield(page_section); nil
  else
    page_section.rich_text_body.to_s.html_safe
  end
end