Sha256: cf8e34aba44ce34a92cae5d98c9be415a9bd8be7dbf9923e3118ae9177702cde

Contents?: true

Size: 680 Bytes

Versions: 10

Compression:

Stored size: 680 Bytes

Contents

class Breadcrumbs::Render::Rademade < Breadcrumbs::Render::Base

  def render
    html = []
    items = breadcrumbs.items
    size = items.size

    items.each_with_index do |item, i|
      html << render_item(item, i, size)
    end

    separator = tag(:span, '', :class => 'breadcrumbs-sep')

    tag(:div, html.join(" #{separator} "), :class => 'breadcrumbs')
  end

  def render_item(item, i, size)
    text, url, options = *item
    options[:class] ||= 'breadcrumbs-link'

    if i == size - 1
      options[:class] += ' current'
      options[:tag] = 'span'
    end

    options[:class].gsub!(/^ *(.*?)$/, '\\1')

    wrap_item(url, CGI.escapeHTML(text), options)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rademade_admin-0.2.2 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.2.1 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.2.0 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.6 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.5 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.4 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.3 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.2 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.1 lib/rademade_admin/breadcrumbs/render/rademade.rb
rademade_admin-0.1.0 lib/rademade_admin/breadcrumbs/render/rademade.rb