active_link_to 0.0.4 → 0.0.5

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 CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_link_to}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov"]
12
- s.date = %q{2009-10-13}
12
+ s.date = %q{2009-10-27}
13
13
  s.description = %q{Extremely helpful when you need to add some logic that figures out if the link (or more often navigation item) is selected based on the current page or other arbitrary condition}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -142,7 +142,7 @@ module ActiveLinkTo
142
142
  def is_active_link?(url, options = {})
143
143
  case options[:when]
144
144
  when :self, nil
145
- !request.request_uri.match(/^#{Regexp.escape(url)}(\/.*)?$/).blank?
145
+ !request.request_uri.match(/^#{Regexp.escape(url)}(\/?.*)?$/).blank?
146
146
  when :self_only
147
147
  !request.request_uri.match(/^#{Regexp.escape(url)}\/?(\?.*)?$/).blank?
148
148
  when Regexp
@@ -12,6 +12,12 @@ class ActiveLinkToTest < Test::Unit::TestCase
12
12
  assert_equal '<a href="/not-test">name</a>', out
13
13
  end
14
14
 
15
+ def test_matching_self_with_extra_parameters
16
+ request.request_uri = '/test?status=what'
17
+ out = active_link_to 'name', '/test'
18
+ assert_equal '<a href="/test" class="active">name</a>', out
19
+ end
20
+
15
21
  def test_matching_self_only
16
22
  request.request_uri = '/test/fail'
17
23
  out = active_link_to 'name', '/test/fail', :active => { :when => :self_only }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_link_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-13 00:00:00 -04:00
12
+ date: 2009-10-27 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15