Sha256: fd4c503092b2bd4b5aa01d8c49fd0a2b8fc7b6167b400813bc44f0e086cdd234

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

require "simple_navigation"

module TidaConteTemplate
  class BreadcrumbsRenderer < ::SimpleNavigation::Renderer::Base
    def render(item_container)
      a_tags(item_container).join.html_safe
    end

    protected

    def a_tags(item_container)
      item_container.items.inject([]) do |list, item|
        if item.selected?
          list << content_tag(:li, tag_for(item)) if item.selected?
          if include_sub_navigation?(item)
            list.concat a_tags(item.sub_navigation)
          end
        end
        list
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tida_conte_template-0.1.19 lib/breadcrumbs_renderer.rb