breadcrumbs 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -38,6 +38,10 @@ On your view (possibly application.html.erb):
38
38
 
39
39
  <%= breadcrumbs.render %>
40
40
 
41
+ You can render as ordered list.
42
+
43
+ <%= breadcrumbs.render(:format => :ordered_list) %>
44
+
41
45
  You can render as inline links.
42
46
 
43
47
  <%= breadcrumbs.render(:format => :inline) %>
data/lib/breadcrumbs.rb CHANGED
@@ -31,6 +31,7 @@ class Breadcrumbs
31
31
  # breadcrumbs.render(:format => :inline)
32
32
  # breadcrumbs.render(:format => :inline, :separator => "|")
33
33
  # breadcrumbs.render(:format => :list)
34
+ # breadcrumbs.render(:format => :ordered_list)
34
35
  # breadcrumbs.render(:id => "breadcrumbs")
35
36
  # breadcrumbs.render(:class => "breadcrumbs")
36
37
  #
@@ -2,9 +2,14 @@ class Breadcrumbs
2
2
  module Render
3
3
  class List < Base # :nodoc: all
4
4
  def render
5
- options = {:class => "breadcrumbs"}.merge(default_options)
5
+ options = {
6
+ :class => "breadcrumbs",
7
+ :format => :list
8
+ }.merge(default_options)
6
9
 
7
- tag(:ul, options) do
10
+ list_style = options[:format] == :list ? :ul : :ol
11
+
12
+ tag(list_style, options) do
8
13
  html = ""
9
14
  items = breadcrumbs.items
10
15
  size = items.size
@@ -2,7 +2,7 @@ class Breadcrumbs
2
2
  module Version # :nodoc: all
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -45,6 +45,13 @@ class BreadcrumbsTest < Test::Unit::TestCase
45
45
  assert_not_nil html.at("ul.breadcrumbs")
46
46
  end
47
47
 
48
+ def test_render_as_ordered_list
49
+ @breadcrumbs.add "Home", "/"
50
+ html = Nokogiri::HTML(@breadcrumbs.render(:format => :ordered_list))
51
+
52
+ assert_not_nil html.at("ol.breadcrumbs")
53
+ end
54
+
48
55
  def test_render_as_list_with_custom_attributes
49
56
  @breadcrumbs.add "Home", "/", :class => "home"
50
57
  html = Nokogiri::HTML(@breadcrumbs.render(:id => "breadcrumbs", :class => "top"))
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breadcrumbs
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 3
9
- version: 0.1.3
4
+ version: 0.1.4
10
5
  platform: ruby
11
6
  authors:
12
7
  - Nando Vieira
@@ -14,7 +9,7 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-07-07 00:00:00 -03:00
12
+ date: 2010-08-12 00:00:00 -03:00
18
13
  default_executable:
19
14
  dependencies: []
20
15
 
@@ -51,20 +46,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
46
  requirements:
52
47
  - - ">="
53
48
  - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
49
  version: "0"
50
+ version:
57
51
  required_rubygems_version: !ruby/object:Gem::Requirement
58
52
  requirements:
59
53
  - - ">="
60
54
  - !ruby/object:Gem::Version
61
- segments:
62
- - 0
63
55
  version: "0"
56
+ version:
64
57
  requirements: []
65
58
 
66
59
  rubyforge_project:
67
- rubygems_version: 1.3.6
60
+ rubygems_version: 1.3.5
68
61
  signing_key:
69
62
  specification_version: 3
70
63
  summary: Breadcrumbs is a simple plugin that adds a `breadcrumbs` object to controllers and views.