class FoundationBuilder

Foundation 6 builder for breadcrumbs :nocov:

Public Instance Methods

render() click to toggle source

@return [String] representing the breadcrumb

# File lib/integral/foundation_builder.rb, line 5
def render
  output = ''
  output += "<nav aria-label='You are here:' role='navigation'>"
  output += "<ul class='breadcrumbs'>"

  output += @elements.collect do |element|
    render_element(element)
  end.join

  output += '</ul>'
  output += '</nav>'
  output
end

Private Instance Methods

render_element(element) click to toggle source
# File lib/integral/foundation_builder.rb, line 21
def render_element(element)
  if element.path.nil? || @context.current_page?(compute_path(element))
    @context.content_tag :li do
      @context.content_tag(:span, 'Current: ', class: 'show-for-sr') +
        compute_name(element)
    end
  else
    @context.content_tag :li do
      @context.link_to(compute_name(element), compute_path(element), element.options)
    end
  end
end