Sha256: ca701b30df65e30874ec415faf8c2adb7eb8b5680b2ff39fd3a6cb3d48ea06d4

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

module Cadmus::RenderingHelper
  def render_cadmus_page_in_effective_layout(page)
    page_content = cadmus_renderer.render(@page.liquid_template, :html)
    cms_layout = @page.effective_cms_layout
    render_in_cadmus_layout(page_content, cms_layout, 'page' => page)
  end

  def render_in_cadmus_layout(content, cms_layout, assigns = {})
    if cms_layout
      assigns = assigns.merge({ 'content_for_layout' => content })
      if defined?(:liquid_assigns_for_layout)
        assigns.reverse_merge!(liquid_assigns_for_layout(cms_layout))
      end

      cadmus_renderer.render(cms_layout.liquid_template, :html, assigns: assigns, registers: { 'parent' => cms_layout.parent })
    else
      content_for :content do
        content
      end

      render template: 'layouts/application'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cadmus-0.7.1 app/helpers/cadmus/rendering_helper.rb
cadmus-0.7.0 app/helpers/cadmus/rendering_helper.rb