Sha256: 9369f76e81618473d46686526c3ec590db471bf48300bc56b41eea32aab60425

Contents?: true

Size: 514 Bytes

Versions: 28

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

module EffectivePageSectionsHelper

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

  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

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
effective_pages-3.8.2 app/helpers/effective_page_sections_helper.rb
effective_pages-3.8.1 app/helpers/effective_page_sections_helper.rb
effective_pages-3.8.0 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.11 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.10 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.9 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.8 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.7 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.6 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.5 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.4 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.3 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.2 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.1 app/helpers/effective_page_sections_helper.rb
effective_pages-3.7.0 app/helpers/effective_page_sections_helper.rb
effective_pages-3.6.0 app/helpers/effective_page_sections_helper.rb
effective_pages-3.5.0 app/helpers/effective_page_sections_helper.rb
effective_pages-3.4.13 app/helpers/effective_page_sections_helper.rb
effective_pages-3.4.12 app/helpers/effective_page_sections_helper.rb
effective_pages-3.4.11 app/helpers/effective_page_sections_helper.rb