Sha256: d8bee8786924f8280b555f5e0dab4ba8dd11f0a7abd8fb31fd56b73c84a23e80
Contents?: true
Size: 1.03 KB
Versions: 31
Compression:
Stored size: 1.03 KB
Contents
module CrumbsHelper # breadcrumb("Home" => "/", "Blog" => [:site, :blog], @post.title => request.path ) def breadcrumb(crumbs = {}) crumbs = crumbs.to_a buff = "" buff << '<ul class="breadcrumb">' active = crumbs.pop crumbs.each do |title, path| path = !path.is_a?(String) ? polymorphic_path(path) : h(path) buff << <<-eos <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> <a itemprop="url" href="#{path}"> <span itemprop="title">#{h(title)}</span> </a> <span class="divider">/</span> </li> eos end title, path = active path = !path.is_a?(String) ? polymorphic_path(path) : h(path) buff << <<-eos <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"> <a itemprop="url" href="#{path}"> <span itemprop="title">#{h(title)}</span> </a> </li> eos buff << '</ul>' content_for( :breadcrumb, buff.html_safe ) nil end end
Version data entries
31 entries across 31 versions & 1 rubygems