breadcrumbs 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -64,6 +64,10 @@ In fact, you can provide any scope you want.
64
64
 
65
65
  breadcrumbs.add "titles.home"
66
66
 
67
+ If you don't want to translate a label, just pass the option <tt>:i18n</tt> as <tt>false</tt>.
68
+
69
+ breadcrumbs.add :home, nil, :i18n => false
70
+
67
71
  == Maintainer
68
72
 
69
73
  * Nando Vieira - http://simplesideias.com.br
@@ -2,7 +2,7 @@ class Breadcrumbs
2
2
  module Version # :nodoc: all
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 2
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/lib/breadcrumbs.rb CHANGED
@@ -19,7 +19,9 @@ class Breadcrumbs
19
19
  # find it as I18n scope.
20
20
  #
21
21
  def add(text, url = nil, options = {})
22
- items << [translate(text), url, options]
22
+ options.reverse_merge!(:i18n => true)
23
+ text = translate(text) if options.delete(:i18n)
24
+ items << [text.to_s, url, options]
23
25
  end
24
26
 
25
27
  # Render breadcrumbs using the specified format.
@@ -133,6 +133,18 @@ class BreadcrumbsTest < Test::Unit::TestCase
133
133
  assert_equal "|", html.at("span.separator").inner_text
134
134
  end
135
135
 
136
+ def test_render_original_text_when_disabling_translation
137
+ @breadcrumbs.add :home, nil, :i18n => false
138
+ @breadcrumbs.add :people
139
+
140
+ html = Nokogiri::HTML(@breadcrumbs.render)
141
+
142
+ items = html.search("li")
143
+
144
+ assert_equal "home", items[0].inner_text
145
+ assert_equal "Nosso time", items[1].inner_text
146
+ end
147
+
136
148
  def test_render_internationalized_text_using_default_scope
137
149
  @breadcrumbs.add :home
138
150
  @breadcrumbs.add :people
data/test/test_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "rubygems"
2
2
  require "test/unit"
3
+ require "cgi"
3
4
  require "nokogiri"
4
5
  require "action_controller"
5
6
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-25 00:00:00 -03:00
17
+ date: 2010-04-15 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency