Sha256: 8b772684188315ebc95f41686462b63b84fe4d496fb5c708cf4c5315154214b0

Contents?: true

Size: 504 Bytes

Versions: 4

Compression:

Stored size: 504 Bytes

Contents

module Lookbook
  # Helpers for documentation page templates
  #
  # @api public
  module PageHelper
    # Returns the URL path to a page.
    #
    # @param id [String, PageEntity] The id or PageEntity instance to generate a URL path for
    def page_path(id)
      page = id.is_a?(PageEntity) ? id : Engine.pages.find_by_id(id)
      if page.present?
        lookbook_page_path page.lookup_path
      else
        Lookbook.logger.warn "Could not find page with id ':#{id}'"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lookbook-2.0.0.beta.3 lib/lookbook/helpers/page_helper.rb
lookbook-2.0.0.beta.2 lib/lookbook/helpers/page_helper.rb
lookbook-2.0.0.beta.1 lib/lookbook/helpers/page_helper.rb
lookbook-2.0.0.beta.0 lib/lookbook/helpers/page_helper.rb