active_link_to 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -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.9"
8
+ s.version = "0.0.10"
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{2011-07-18}
12
+ s.date = %q{2011-07-19}
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 = [
@@ -140,6 +140,7 @@ module ActiveLinkTo
140
140
 
141
141
  # Returns true or false. Takes the link's URL and :active parameters
142
142
  def is_active_link?(url, options = {})
143
+ url = url.sub(/\?.*/, '')
143
144
  case options[:when]
144
145
  when :self, nil
145
146
  !request.fullpath.match(/^#{Regexp.escape(url)}(\/.*|\?.*)?$/).blank?
@@ -27,6 +27,12 @@ class ActiveLinkToTest < Test::Unit::TestCase
27
27
  assert_equal '<a href="/test" class="active">name</a>', out
28
28
  end
29
29
 
30
+ def test_matching_self_with_extra_params_in_the_link
31
+ request.fullpath = '/test?status=what'
32
+ out = active_link_to 'name', '/test?what=status'
33
+ assert_equal '<a href="/test?what=status" class="active">name</a>', out
34
+ end
35
+
30
36
  def test_matching_self_only
31
37
  request.fullpath = '/test/fail'
32
38
  out = active_link_to 'name', '/test/fail', :active => { :when => :self_only }
@@ -49,7 +55,6 @@ class ActiveLinkToTest < Test::Unit::TestCase
49
55
  assert_equal '<a href="/test">name</a>', out
50
56
  end
51
57
 
52
-
53
58
  def test_matching_controller_action_singular_values
54
59
  request.fullpath = '/test/23'
55
60
  params[:controller], params[:action] = 'tests', 'show'
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.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-18 00:00:00.000000000 -04:00
12
+ date: 2011-07-19 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: Extremely helpful when you need to add some logic that figures out if