Sha256: c263a78b6d29073a7f38debe79e9a8b79d9e173960f50762a047723a2d09a1a4

Contents?: true

Size: 849 Bytes

Versions: 4

Compression:

Stored size: 849 Bytes

Contents

module Lookbook
  class PageController < ActionController::Base
    helper Lookbook::ComponentHelper
    helper Lookbook::PageHelper
    helper Lookbook::OutputHelper

    Lookbook.config.page_paths.each do |path|
      prepend_view_path Rails.root.join(path)
    end

    def render_page(page, locals = {})
      @page = page
      @pages = Lookbook.pages
      @next_page = @pages.find_next(@page)
      @previous_page = @pages.find_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, Lookbook.config.markdown_options) : content
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lookbook-1.3.4 app/controllers/lookbook/page_controller.rb
lookbook-1.3.3 app/controllers/lookbook/page_controller.rb
lookbook-1.3.1 app/controllers/lookbook/page_controller.rb
lookbook-1.3.0 app/controllers/lookbook/page_controller.rb