Sha256: c905da7909ec7075f0ac9fc39b5974c559d5fa85aa516e9d7dfaef1c6b9e2d30

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module EffectivePageSegmentsHelper

  # This is a scrollspy navbar
  # = render_page_segments_menu(class: 'navbar navbar-light bg-light')
  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

  # Renders all page segments for one page
  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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_pages-3.13.5 app/helpers/effective_page_segments_helper.rb
effective_pages-3.13.4 app/helpers/effective_page_segments_helper.rb
effective_pages-3.13.3 app/helpers/effective_page_segments_helper.rb
effective_pages-3.13.2 app/helpers/effective_page_segments_helper.rb
effective_pages-3.13.1 app/helpers/effective_page_segments_helper.rb
effective_pages-3.13.0 app/helpers/effective_page_segments_helper.rb