Class: Xhive::PagePresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/xhive/page_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#object

Instance Method Summary collapse

Methods inherited from BasePresenter

#id, #initialize, #safe_user

Constructor Details

This class inherits a constructor from Xhive::BasePresenter

Instance Method Details

#render_content(options = {}) ⇒ Object

Public: renders the page content.

options - The Hash containing the values to use inside the template.

Returns: the rendered page content.



14
15
16
17
18
19
20
21
# File 'app/presenters/xhive/page_presenter.rb', line 14

def render_content(options={})
  layout = ::Liquid::Template.parse("{{content}}").render({"content" => page.content})
  result = ::Liquid::Template.parse(layout).render(optional_data(options), :registers => {:controller => controller}).html_safe
rescue => e
  log_error(e)
ensure
  return filter_images_urls(result.to_s)
end

#render_title(options = {}) ⇒ Object

Public: renders the page title.

options - The Hash containing the values to use inside the template.

Returns: the rendered page title.



29
30
31
32
33
34
35
# File 'app/presenters/xhive/page_presenter.rb', line 29

def render_title(options={})
  result = ::Liquid::Template.parse(title).render(optional_data(options))
rescue => e
  log_error(e)
ensure
  return result.to_s
end