active_link_to 1.0.1 → 1.0.2
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.
- checksums.yaml +7 -0
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/lib/active_link_to/active_link_to.rb +1 -1
- data/lib/active_link_to/version.rb +1 -1
- data/test/active_link_to_test.rb +8 -0
- metadata +9 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2c052d4d3334d1179c4dbcd757c1c233749a1915
|
4
|
+
data.tar.gz: a785035a19b30281072c0cbeb759f31db8ebe062
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d30230c3717c74f71a7daa41651cfda982dfe48dc9cc5ebb414f16d00a8351e4f7f0d1bf0b1ffea9ea08bbcfca5e61fdcfde7b600842561a3eeba12268f389c
|
7
|
+
data.tar.gz: 422d6301125a96c456aa33f480d0271d213bbefa7b41f5e3af1218d685f747e706c9afb1c0071b581b5c9a6c84c3d5f46839a59c5fff4d7aaf277dba4c22f488
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
Creates a link tag of the given name using a URL created by the set of options. Please see documentation for
|
1
|
+
# active_link_to
|
2
|
+
Creates a link tag of the given name using a URL created by the set of options. Please see documentation for [link_to](http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to), as `active_link_to` is basically a wrapper for it. This method accepts an optional :active parameter that dictates if the given link will have an extra css class attached that marks it as 'active'.
|
3
3
|
|
4
4
|
## Install
|
5
5
|
When installing for Rails 3 applications add this to the Gemfile: `gem 'active_link_to'` and run `bundle install`.
|
@@ -93,7 +93,7 @@ active_link_to 'News', news_path, :class_inactive => 'disabled'
|
|
93
93
|
Sometimes you want to replace link tag with a span if it's active:
|
94
94
|
|
95
95
|
```ruby
|
96
|
-
active_link_to 'Users', users_path, :
|
96
|
+
active_link_to 'Users', users_path, :active_disable => true
|
97
97
|
# => <span class="active">Users</span>
|
98
98
|
```
|
99
99
|
|
@@ -123,4 +123,4 @@ active_link_to_class(users_path, :active => :inclusive)
|
|
123
123
|
|
124
124
|
### Copyright
|
125
125
|
|
126
|
-
Copyright (c) 2009-
|
126
|
+
Copyright (c) 2009-14 Oleg Khabarov, The Working Group Inc. See LICENSE for details.
|
@@ -44,7 +44,7 @@ module ActiveLinkTo
|
|
44
44
|
link_to(name, url, link_options)
|
45
45
|
end
|
46
46
|
|
47
|
-
wrap_tag ? content_tag(wrap_tag, link, :class => css_class) : link
|
47
|
+
wrap_tag ? content_tag(wrap_tag, link, :class => (css_class if css_class.present?)) : link
|
48
48
|
end
|
49
49
|
|
50
50
|
# Returns css class name. Takes the link's URL and its params
|
data/test/active_link_to_test.rb
CHANGED
@@ -150,4 +150,12 @@ class ActiveLinkToTest < Test::Unit::TestCase
|
|
150
150
|
assert_equal ({:class => 'testing', :active => :inclusive }), params
|
151
151
|
end
|
152
152
|
|
153
|
+
def test_no_empty_class_attribute
|
154
|
+
request.fullpath = '/root'
|
155
|
+
link = active_link_to('label', '/root', :wrap_tag => :li)
|
156
|
+
assert_equal '<li class="active"><a class="active" href="/root">label</a></li>', link
|
157
|
+
|
158
|
+
link = active_link_to('label', '/other', :wrap_tag => :li)
|
159
|
+
assert_equal '<li><a href="/other">label</a></li>', link
|
160
|
+
end
|
153
161
|
end
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_link_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Oleg Khabarov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: actionpack
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: Helpful method when you need to add some logic that figures out if the
|
@@ -49,26 +46,25 @@ files:
|
|
49
46
|
- test/test_helper.rb
|
50
47
|
homepage: http://github.com/twg/active_link_to
|
51
48
|
licenses: []
|
49
|
+
metadata: {}
|
52
50
|
post_install_message:
|
53
51
|
rdoc_options: []
|
54
52
|
require_paths:
|
55
53
|
- lib
|
56
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
55
|
requirements:
|
59
|
-
- -
|
56
|
+
- - '>='
|
60
57
|
- !ruby/object:Gem::Version
|
61
58
|
version: '0'
|
62
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
60
|
requirements:
|
65
|
-
- -
|
61
|
+
- - '>='
|
66
62
|
- !ruby/object:Gem::Version
|
67
63
|
version: '0'
|
68
64
|
requirements: []
|
69
65
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 2.1.10
|
71
67
|
signing_key:
|
72
|
-
specification_version:
|
68
|
+
specification_version: 4
|
73
69
|
summary: ActionView helper to render currently active links
|
74
70
|
test_files: []
|