Sha256: 58e4a2d40755d7b6054c91774b7e97796e82f0c5508b60fcc2d1ec59b5d6baec
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module Refinery module Pages # A type of ContentPresenter which specifically knows how to render the html for a Refinery CMS # page object. Pass the page object into the constructor, and it will build sections from the # page's parts. The page is not retained internally, so if the page changes, you need to rebuild # this ContentPagePresenter. class ContentPagePresenter < ContentPresenter def initialize(page, page_title) super() add_default_title_section(page_title) if page_title.present? add_page_parts(page.parts) if page add_default_post_page_sections end private def add_default_title_section(title) add_section TitleSectionPresenter.new(:id => :body_content_title, :fallback_html => title) end def add_default_post_page_sections add_section_if_missing(:id => :body_content_left) add_section_if_missing(:id => :body_content_right) end def add_page_parts(parts) parts.each do |part| add_section PagePartSectionPresenter.new(part) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
refinerycms-pages-2.0.1 | lib/refinery/pages/content_page_presenter.rb |
refinerycms-pages-2.0.0 | lib/refinery/pages/content_page_presenter.rb |