Sha256: 6c81361b9ef2b2b3c94de7a901293d06e8be5b1954202439fa2f11a69e9424c4
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
class Breadcrumbs module Render class List < Base # :nodoc: all def render options = { :class => "breadcrumbs", :format => :list }.merge(default_options) list_style = options[:format] == :list ? :ul : :ol tag(list_style, options) do html = "" items = breadcrumbs.items size = items.size items.each_with_index do |item, i| html << render_item(item, i, size) end html end end def render_item(item, i, size) css = [] css << "first" if i == 0 css << "last" if i == size - 1 css << "item-#{i}" text, url, options = *item text = CGI.escapeHTML(text) text = tag(:a, text, options.merge(:href => url)) if url tag(:li, text, :class => css.join(" ")) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
breadcrumbs-0.1.4 | lib/breadcrumbs/render/list.rb |