Sha256: 4985991c3d634d510badaf8c6d353de5493dfa5f1aaf726a9ea4fa26a87d73a6
Contents?: true
Size: 953 Bytes
Versions: 2
Compression:
Stored size: 953 Bytes
Contents
module Para module Breadcrumbs class Breadcrumb attr_reader :identifier, :_path, :options def initialize(identifier, path, *options) @identifier = identifier @_path = path @options = options end def title @title ||= if Symbol === identifier I18n.t("admin.breadcrumbs.#{ identifier }") else identifier end end # Allow lazy evaluation of routes to define breadcrumbs before being # able to access request or routes def path @path ||= if Symbol === _path find_route_for(_path, *options) elsif _path _path else '#' end end def active?(request) path == request.path || !_path end private def find_route_for(path, *options) Rails.application.routes.url_helpers.send(:"#{ path }_path", *options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
para-0.5.1 | lib/para/breadcrumbs/breadcrumb.rb |
para-0.5.0 | lib/para/breadcrumbs/breadcrumb.rb |