Skip to content

Instantly share code, notes, and snippets.

@mroach
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroach/264c0727b5d1e61c7b19 to your computer and use it in GitHub Desktop.
Save mroach/264c0727b5d1e61c7b19 to your computer and use it in GitHub Desktop.
breadcrumbs_on_rails builder for Semanti UI breadcrumbs
- unless breadcrumbs.empty?
div.ui.breadcrumb
= render_breadcrumbs builder: BreadcrumbsOnRails::Breadcrumbs::SemanticUiBuilder
module BreadcrumbsOnRails
module Breadcrumbs
class SemanticUiBuilder < Builder
def render
@elements.collect do |element|
render_element(element)
end.join(@context.content_tag(:i, '', class: 'right chevron icon divider'))
end
def render_element(element)
if element.path == nil
content = compute_name(element)
else
content = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options)
end
if @options[:tag]
@context.content_tag(:a, content, class: 'section')
else
content
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment