Class: Lookbook::PageController

Inherits:
Rails::ApplicationController
  • Object
show all
Defined in:
app/controllers/lookbook/page_controller.rb

Instance Method Summary collapse

Instance Method Details

#render_page(page, locals = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/lookbook/page_controller.rb', line 12

def render_page(page, locals = {})
  @page = page
  @pages = Engine.pages
  @next_page = @pages.next(@page)
  @previous_page = @pages.previous(@page)

  content = ActionViewAnnotationsHandler.call(disable_annotations: true) do
    render_to_string inline: @page.content, locals: {
      page: @page,
      next_page: @next_page,
      previous_page: @previous_page,
      pages: @pages
    }
  end

  @page.markdown? ? MarkdownRenderer.call(content) : content
end