lib/breadcrumbs/render/list.rb in breadcrumbs-0.1.4 vs lib/breadcrumbs/render/list.rb in breadcrumbs-0.1.5
- old
+ new
@@ -1,16 +1,13 @@
class Breadcrumbs
module Render
class List < Base # :nodoc: all
def render
options = {
- :class => "breadcrumbs",
- :format => :list
+ :class => "breadcrumbs"
}.merge(default_options)
- list_style = options[:format] == :list ? :ul : :ol
-
tag(list_style, options) do
html = ""
items = breadcrumbs.items
size = items.size
@@ -20,19 +17,21 @@
html
end
end
+ def list_style
+ :ul
+ 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
-
+ text = wrap_item(url, CGI.escapeHTML(text), options)
tag(:li, text, :class => css.join(" "))
end
end
end
end