simple-navigation 3.3.4 → 3.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/CHANGELOG +5 -0
- data/Gemfile +5 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/simple_navigation/core/item.rb +4 -2
- data/spec/lib/simple_navigation/core/item_spec.rb +24 -6
- metadata +52 -9
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
*3.4.0
|
2
|
+
|
3
|
+
* Added Gemfile for easier development with Bundler. Thanks to Josep Jaume.
|
4
|
+
* modified :highlights_on option to accept a :subpath option (as well as Proc and Regexp forms). This can be used to automatically highlight an item even for items within a subpath. Thanks to Josep Jaume.
|
5
|
+
|
1
6
|
*3.3.4
|
2
7
|
|
3
8
|
* modified :highlights_on option to accept a Proc (as well as the existing Regexp form). This can be used to provide specific highlighting conditions inline. Thanks to superlou for sparking the idea for the concept.
|
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -40,7 +40,7 @@ begin
|
|
40
40
|
gemspec.add_dependency('activesupport', '>= 2.3.2')
|
41
41
|
gemspec.authors = ["Andi Schacke", "Mark J. Titorenko"]
|
42
42
|
gemspec.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
43
|
-
gemspec.files = FileList["[A-Z]*", "{lib,spec,rails,generators}/**/*"] - FileList["**/*.log"]
|
43
|
+
gemspec.files = FileList["[A-Z]*", "{lib,spec,rails,generators}/**/*"] - FileList["**/*.log", "Gemfile.lock"]
|
44
44
|
gemspec.rubyforge_project = 'andi'
|
45
45
|
end
|
46
46
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.0
|
@@ -83,8 +83,10 @@ module SimpleNavigation
|
|
83
83
|
SimpleNavigation.request_uri =~ highlights_on
|
84
84
|
when Proc
|
85
85
|
highlights_on.call
|
86
|
+
when :subpath
|
87
|
+
!!(SimpleNavigation.request_uri =~ /^#{Regexp.escape url_without_anchor}/)
|
86
88
|
else
|
87
|
-
raise ArgumentError, ':highlights_on must be a Regexp or
|
89
|
+
raise ArgumentError, ':highlights_on must be a Regexp, Proc or :subpath'
|
88
90
|
end
|
89
91
|
elsif auto_highlight?
|
90
92
|
!!(root_path_match? || SimpleNavigation.current_page?(url_without_anchor))
|
@@ -114,7 +116,7 @@ module SimpleNavigation
|
|
114
116
|
end
|
115
117
|
|
116
118
|
def url_without_anchor
|
117
|
-
url.split('#').first
|
119
|
+
url.split('#').first
|
118
120
|
end
|
119
121
|
|
120
122
|
end
|
@@ -67,7 +67,7 @@ describe SimpleNavigation::Item do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
context 'setting class and id on the container' do
|
72
72
|
before(:each) do
|
73
73
|
@options = {:container_class => 'container_class', :container_id => 'container_id'}
|
@@ -100,27 +100,27 @@ describe SimpleNavigation::Item do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
context 'url' do
|
105
105
|
context 'url is a string' do
|
106
106
|
before(:each) do
|
107
|
-
@item = SimpleNavigation::Item.new(@item_container, :my_key, 'name', 'url', {})
|
107
|
+
@item = SimpleNavigation::Item.new(@item_container, :my_key, 'name', 'url', {})
|
108
108
|
end
|
109
109
|
it {@item.url.should == 'url'}
|
110
110
|
end
|
111
111
|
context 'url is a proc' do
|
112
112
|
before(:each) do
|
113
|
-
@item = SimpleNavigation::Item.new(@item_container, :my_key, 'name', Proc.new {"my_" + "url"}, {})
|
113
|
+
@item = SimpleNavigation::Item.new(@item_container, :my_key, 'name', Proc.new {"my_" + "url"}, {})
|
114
114
|
end
|
115
115
|
it {@item.url.should == 'my_url'}
|
116
116
|
end
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
end
|
120
120
|
|
121
121
|
describe 'name' do
|
122
122
|
before(:each) do
|
123
|
-
SimpleNavigation.config.stub!(:name_generator => Proc.new {|name| "<span>#{name}</span>"})
|
123
|
+
SimpleNavigation.config.stub!(:name_generator => Proc.new {|name| "<span>#{name}</span>"})
|
124
124
|
end
|
125
125
|
context 'default (generator is applied)' do
|
126
126
|
it {@item.name.should == "<span>name</span>"}
|
@@ -335,6 +335,24 @@ describe SimpleNavigation::Item do
|
|
335
335
|
it {@item.send(:selected_by_condition?).should be_false}
|
336
336
|
end
|
337
337
|
end
|
338
|
+
context ':highlights_on is :subpath' do
|
339
|
+
before(:each) do
|
340
|
+
@item.stub!(:url => '/resources')
|
341
|
+
@item.stub!(:highlights_on => :subpath)
|
342
|
+
end
|
343
|
+
context 'we are in a route beginning with this item path' do
|
344
|
+
before(:each) do
|
345
|
+
SimpleNavigation.stub!(:request_uri => '/resources/id')
|
346
|
+
end
|
347
|
+
it {@item.send(:selected_by_condition?).should be_true}
|
348
|
+
end
|
349
|
+
context 'we are in a route not beginning with this item path' do
|
350
|
+
before(:each) do
|
351
|
+
SimpleNavigation.stub!(:request_uri => '/another_resource/id')
|
352
|
+
end
|
353
|
+
it {@item.send(:selected_by_condition?).should be_false}
|
354
|
+
end
|
355
|
+
end
|
338
356
|
context ':highlights_on is not a regexp or a proc' do
|
339
357
|
before(:each) do
|
340
358
|
@item.stub!(:highlights_on => "not a regexp")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,55 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-08-05 00:00:00.000000000Z
|
15
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: actionpack
|
17
|
+
requirement: &70351130084240 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70351130084240
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &70351130083760 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70351130083760
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &70351130083280 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70351130083280
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rdoc
|
50
|
+
requirement: &70351130082800 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70351130082800
|
16
59
|
- !ruby/object:Gem::Dependency
|
17
60
|
name: rspec
|
18
|
-
requirement: &
|
61
|
+
requirement: &70351130082320 !ruby/object:Gem::Requirement
|
19
62
|
none: false
|
20
63
|
requirements:
|
21
64
|
- - ! '>='
|
@@ -23,10 +66,10 @@ dependencies:
|
|
23
66
|
version: 2.0.1
|
24
67
|
type: :development
|
25
68
|
prerelease: false
|
26
|
-
version_requirements: *
|
69
|
+
version_requirements: *70351130082320
|
27
70
|
- !ruby/object:Gem::Dependency
|
28
71
|
name: activesupport
|
29
|
-
requirement: &
|
72
|
+
requirement: &70351130081840 !ruby/object:Gem::Requirement
|
30
73
|
none: false
|
31
74
|
requirements:
|
32
75
|
- - ! '>='
|
@@ -34,7 +77,7 @@ dependencies:
|
|
34
77
|
version: 2.3.2
|
35
78
|
type: :runtime
|
36
79
|
prerelease: false
|
37
|
-
version_requirements: *
|
80
|
+
version_requirements: *70351130081840
|
38
81
|
description: With the simple-navigation gem installed you can easily create multilevel
|
39
82
|
navigations for your Rails, Sinatra or Padrino applications. The navigation is defined
|
40
83
|
in a single configuration file. It supports automatic as well as explicit highlighting
|
@@ -46,6 +89,7 @@ extra_rdoc_files:
|
|
46
89
|
- README
|
47
90
|
files:
|
48
91
|
- CHANGELOG
|
92
|
+
- Gemfile
|
49
93
|
- README
|
50
94
|
- Rakefile
|
51
95
|
- VERSION
|
@@ -92,7 +136,6 @@ files:
|
|
92
136
|
- spec/lib/simple_navigation/rendering/renderer/text_spec.rb
|
93
137
|
- spec/lib/simple_navigation_spec.rb
|
94
138
|
- spec/spec_helper.rb
|
95
|
-
has_rdoc: true
|
96
139
|
homepage: http://github.com/andi/simple-navigation
|
97
140
|
licenses: []
|
98
141
|
post_install_message:
|
@@ -115,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
158
|
version: '0'
|
116
159
|
requirements: []
|
117
160
|
rubyforge_project: andi
|
118
|
-
rubygems_version: 1.6
|
161
|
+
rubygems_version: 1.8.6
|
119
162
|
signing_key:
|
120
163
|
specification_version: 3
|
121
164
|
summary: simple-navigation is a ruby library for creating navigations (with multiple
|