active_link_to 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,23 @@
1
1
  = active_link_to
2
2
 
3
3
  Creates a link tag of the given +name+ using a URL created by the set of
4
- +options+. Please see documentation for link_to, as active_link_to is
5
- basically a wrapper for it. This method accepts an optional +:active+
4
+ options. Please see documentation for link_to, as active_link_to is
5
+ basically a wrapper for it. This method accepts an optional :active
6
6
  parameter that dictates if the given link will have an extra css class
7
7
  attached that marks it as 'active'.
8
8
 
9
+ === Install
10
+
11
+ $ sudo gem install active_link_to
12
+
13
+ Then you probably want to declare it in your environment.rb
14
+
15
+ config.gem 'active_link_to'
16
+
17
+ and freeze it (preferably):
18
+
19
+ $ rake gems:unpack GEM=active_link_to
20
+
9
21
  === Super Simple Example
10
22
  Here's a link that will have class attached if it happens to be rendered
11
23
  on page with path /people or any child of that page like /people/123
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -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.3"
8
+ s.version = "0.0.4"
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-01}
12
+ s.date = %q{2009-10-13}
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 = [
@@ -17,8 +17,7 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".document",
21
- ".gitignore",
20
+ ".gitignore",
22
21
  "LICENSE",
23
22
  "README.rdoc",
24
23
  "Rakefile",
@@ -111,6 +111,9 @@ module ActiveLinkTo
111
111
  html_options = args[2] || {}
112
112
  end
113
113
 
114
+ options = options.clone
115
+ html_options = html_options.clone
116
+
114
117
  url = url_for(options)
115
118
  active_link_options = html_options.delete(:active) || {}
116
119
  css_class = active_class(url, active_link_options)
@@ -73,4 +73,12 @@ class ActiveLinkToTest < Test::Unit::TestCase
73
73
  assert_equal '<span class="active">name</span>', out
74
74
  end
75
75
 
76
+ def test_should_not_modify_passed_params
77
+ request.request_uri = '/test'
78
+ params = {:class => 'testing'}
79
+ out = active_link_to 'name', '/test', params
80
+ assert_equal '<a href="/test" class="testing active">name</a>', out
81
+ assert_equal ({:class => 'testing'}), params
82
+ end
83
+
76
84
  end
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.3
4
+ version: 0.0.4
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-01 00:00:00 -04:00
12
+ date: 2009-10-13 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,7 +23,6 @@ extra_rdoc_files:
23
23
  - LICENSE
24
24
  - README.rdoc
25
25
  files:
26
- - .document
27
26
  - .gitignore
28
27
  - LICENSE
29
28
  - README.rdoc
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE