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 +1 -1
- data/active_link_to.gemspec +2 -2
- data/lib/active_link_to.rb +1 -1
- data/test/active_link_to_test.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/active_link_to.gemspec
CHANGED
@@ -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.
|
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-
|
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 = [
|
data/lib/active_link_to.rb
CHANGED
@@ -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)}(
|
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
|
data/test/active_link_to_test.rb
CHANGED
@@ -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
|
+
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-
|
12
|
+
date: 2009-10-27 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|