Module: EffectivePageSegmentsHelper

Defined in:
app/helpers/effective_page_segments_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_page_segments(page = nil, options = {}) ⇒ Object

Renders all page segments for one page



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/effective_page_segments_helper.rb', line 25

def render_page_segments(page = nil, options = {})
  (options = page; page = nil) if page.kind_of?(Hash)
  page ||= @page

  raise('Expected an Effective::Page') if page && !page.kind_of?(Effective::Page)
  raise('Expected a Hash of options') unless options.kind_of?(Hash)

  return if page.blank?
  return if page.page_segments.blank?

  render('effective/page_segments/content', page: page, html_options: options)
end

#render_page_segments_menu(page = nil, options = {}) ⇒ Object

This is a scrollspy navbar

render_page_segments_menu(class: ‘navbar navbar-light bg-light’)



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

def render_page_segments_menu(page = nil, options = {})
  (options = page; page = nil) if page.kind_of?(Hash)
  page ||= @page

  raise('Expected an Effective::Page') if page && !page.kind_of?(Effective::Page)
  raise('Expected a Hash of options') unless options.kind_of?(Hash)

  return if page.blank?
  return if page.page_segments.blank?
  return unless page.template_page_segments?

  # Default options
  options[:class] ||= 'navbar navbar-light bg-light'

  render('effective/page_segments/menu', page: page, html_options: options)
end