xebec 2.3.0 → 2.4.0
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/VERSION +1 -1
- data/lib/xebec/nav_bar_renderer.rb +8 -3
- data/test/nav_bar_renderer_test.rb +3 -3
- data/xebec.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
@@ -12,7 +12,7 @@ module Xebec
|
|
12
12
|
# render the NavBar as an HTML list.
|
13
13
|
#
|
14
14
|
# @param [Xebec::NavBar] bar the navigation bar to renderer
|
15
|
-
# @param [#tag AND #content_tag AND #link_to] helper the ActionView helper
|
15
|
+
# @param [#tag AND #content_tag AND #link_to AND #current_page?] helper the ActionView helper
|
16
16
|
def initialize(bar, helper)
|
17
17
|
raise ArgumentError.new("#{bar || '<nil>'} is not a NavBar") unless bar.kind_of?(NavBar)
|
18
18
|
raise ArgumentError.new("#{helper || '<nil>'} does not seem to be a view helper") unless
|
@@ -90,10 +90,15 @@ module Xebec
|
|
90
90
|
def render_nav_item(item)
|
91
91
|
text = text_for_nav_item item
|
92
92
|
href = href_for_nav_item item
|
93
|
+
is_current = is_current_nav_item?(item, href)
|
93
94
|
klass = item.name.to_s
|
94
|
-
klass << " #{Xebec.currently_selected_nav_item_class}" if
|
95
|
+
klass << " #{Xebec.currently_selected_nav_item_class}" if is_current
|
95
96
|
helper.content_tag :li, :class => klass do
|
96
|
-
|
97
|
+
if is_current
|
98
|
+
helper.content_tag :span, text
|
99
|
+
else
|
100
|
+
helper.link_to text, href
|
101
|
+
end
|
97
102
|
end
|
98
103
|
end
|
99
104
|
|
@@ -92,7 +92,7 @@ class NavBarRendererTest < Test::Unit::TestCase
|
|
92
92
|
end
|
93
93
|
should 'render a navigation bar with the item marked as current' do
|
94
94
|
assert_select_from @renderer.to_s, 'ul' do
|
95
|
-
assert_select 'li.foo.current', 'Foo'
|
95
|
+
assert_select 'li.foo.current span', 'Foo'
|
96
96
|
end
|
97
97
|
end
|
98
98
|
context 'when Xebec is configured to use a different "current" class' do
|
@@ -102,7 +102,7 @@ class NavBarRendererTest < Test::Unit::TestCase
|
|
102
102
|
end
|
103
103
|
should 'use the configured CSS class' do
|
104
104
|
assert_select_from @renderer.to_s, 'ul' do
|
105
|
-
assert_select 'li.foo.active', 'Foo'
|
105
|
+
assert_select 'li.foo.active span', 'Foo'
|
106
106
|
end
|
107
107
|
end
|
108
108
|
teardown do
|
@@ -162,7 +162,7 @@ class NavBarRendererTest < Test::Unit::TestCase
|
|
162
162
|
end
|
163
163
|
should 'add the "current" class to the current item' do
|
164
164
|
assert_select_from @renderer.to_s, 'ul' do
|
165
|
-
assert_select 'li.home.current', 'Home'
|
165
|
+
assert_select 'li.home.current span', 'Home'
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
data/xebec.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xebec}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James A. Rosen"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-31}
|
13
13
|
s.description = %q{Helpers for generating navigation bars}
|
14
14
|
s.email = %q{james.a.rosen@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 2.
|
9
|
+
version: 2.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- James A. Rosen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-31 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|