Sha256: 38473d67f552842ec7de24269f395f42810ffd35ab6e8ea0265adc9249fc459f

Contents?: true

Size: 839 Bytes

Versions: 12

Compression:

Stored size: 839 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.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, Lookbook.config.markdown_options) : content
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lookbook-1.5.5 app/controllers/lookbook/page_controller.rb
lookbook-1.5.4 app/controllers/lookbook/page_controller.rb
lookbook-1.5.3 app/controllers/lookbook/page_controller.rb
lookbook-1.5.2 app/controllers/lookbook/page_controller.rb
lookbook-1.5.1 app/controllers/lookbook/page_controller.rb
lookbook-1.5.0 app/controllers/lookbook/page_controller.rb
lookbook-1.4.5 app/controllers/lookbook/page_controller.rb
lookbook-1.4.4 app/controllers/lookbook/page_controller.rb
lookbook-1.4.3 app/controllers/lookbook/page_controller.rb
lookbook-1.4.2 app/controllers/lookbook/page_controller.rb
lookbook-1.4.1 app/controllers/lookbook/page_controller.rb
lookbook-1.4.0 app/controllers/lookbook/page_controller.rb