breadcrumbs 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/lib/breadcrumbs/version.rb +1 -1
- data/lib/breadcrumbs.rb +3 -1
- data/test/breadcrumbs_test.rb +12 -0
- data/test/test_helper.rb +1 -0
- metadata +3 -3
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
|
data/lib/breadcrumbs/version.rb
CHANGED
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
|
-
|
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.
|
data/test/breadcrumbs_test.rb
CHANGED
@@ -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
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.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-
|
17
|
+
date: 2010-04-15 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|