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

Version Path
fullstack-cms-0.4.6 app/helpers/crumbs_helper.rb
fullstack-cms-0.4.5 app/helpers/crumbs_helper.rb
fullstack-cms-0.4.4 app/helpers/crumbs_helper.rb
fullstack-cms-0.4.3 app/helpers/crumbs_helper.rb
fullstack-cms-0.4.2 app/helpers/crumbs_helper.rb
fullstack-cms-0.4.1 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.39 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.38 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.37 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.36 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.35 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.34 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.33 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.32 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.31 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.30 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.29 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.28 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.27 app/helpers/crumbs_helper.rb
fullstack-cms-0.3.26 app/helpers/crumbs_helper.rb