simple-navigation 3.1.0 → 3.1.1

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 CHANGED
@@ -1,4 +1,9 @@
1
+ *3.1.1
2
+
3
+ * Item#selected_by_url? now strips anchors from the item's url before comparing it with the current request's url. Credits to opengovernment.
4
+
1
5
  *3.1.0
6
+
2
7
  * added new helper method 'active_navigation_item_name' to render the name of the currently active item
3
8
 
4
9
  *3.0.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.1.1
@@ -69,7 +69,7 @@ module SimpleNavigation
69
69
  raise ArgumentError, ':highlights_on must be a regexp' unless highlights_on.instance_of?(Regexp)
70
70
  SimpleNavigation.request_uri =~ highlights_on
71
71
  elsif auto_highlight?
72
- !!(root_path_match? || SimpleNavigation.current_page?(url))
72
+ !!(root_path_match? || SimpleNavigation.current_page?(url_without_anchor))
73
73
  else
74
74
  false
75
75
  end
@@ -95,5 +95,9 @@ module SimpleNavigation
95
95
  SimpleNavigation.config.auto_highlight && @container.auto_highlight
96
96
  end
97
97
 
98
+ def url_without_anchor
99
+ url.split('#').first
100
+ end
101
+
98
102
  end
99
103
  end
@@ -349,6 +349,11 @@ describe SimpleNavigation::Item do
349
349
  @adapter.should_receive(:current_page?).with('url')
350
350
  @item.send(:selected_by_url?)
351
351
  end
352
+ it "should remove anchors before testing the item's url" do
353
+ @item.stub!(:url => 'url#anchor')
354
+ @adapter.should_receive(:current_page?).with('url')
355
+ @item.send(:selected_by_url?)
356
+ end
352
357
  it {@item.send(:selected_by_url?).should be_true}
353
358
  end
354
359
  context 'no match' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 0
10
- version: 3.1.0
9
+ - 1
10
+ version: 3.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andi Schacke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-27 00:00:00 +01:00
18
+ date: 2011-01-13 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency