Module: Simplec::PageActionHelpers::InstanceMethods

Defined in:
lib/simplec/page_action_helpers.rb

Instance Method Summary collapse

Instance Method Details

#layout(page) ⇒ String

Determine the layout for a page.

Parameters:

Returns:

  • (String)

    layout name



31
32
33
34
35
# File 'lib/simplec/page_action_helpers.rb', line 31

def layout(page)
  # TODO allow config for public
  [page.layout, page.subdomain.default_layout, 'public'].
    reject(&:blank?).first
end

#render_path(path, options = {}) ⇒ Object

Render the template and layout for a path.

Parameters:

  • path (String)

    a path without a leading /

  • options (Hash) (defaults to: {})

    passed through to underlying render



17
18
19
20
21
22
23
# File 'lib/simplec/page_action_helpers.rb', line 17

def render_path(path, options={})
  @page = page(path)
  render options.merge(
    template: 'simplec/pages/show',
    layout: layout(@page)
  )
end