active_link_to 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/active_link_to/active_link_to.rb +7 -10
- data/lib/active_link_to/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0d98b57bf4abf67586e2eb4121f6fdd0b435b2e
|
4
|
+
data.tar.gz: 7c59ffc37c74c76e97fa7d0d67918f2a91e6ecea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd29e30982524b635daba3fdfd64df45d4bc91c000d3c5946d00cde1732a2a791e548d74b6b204935aebad5c4d06150e42faa0eb40e4a19ee381dd8b30205fe4
|
7
|
+
data.tar.gz: 432188f6449e92a6fa822d8feecb516ee47afee975243fd66de33f57eb4245de934ed942ecf3d062a6680f6c0450d15c30a410bcd86173b343aec9575d53f364
|
data/README.md
CHANGED
@@ -28,7 +28,6 @@ active_link_to 'Users', '/users', active: :inclusive
|
|
28
28
|
Here's a list of available options that can be used as the `:active` value
|
29
29
|
|
30
30
|
```
|
31
|
-
<<<<<<< HEAD
|
32
31
|
* Boolean -> true | false
|
33
32
|
* Symbol -> :exclusive | :inclusive | :exact
|
34
33
|
* Regex -> /regex/
|
@@ -79,7 +78,7 @@ or action, or both? Or any number of those at the same time? Sure, why not:
|
|
79
78
|
active_link_to 'User Edit', edit_user_path(@user), active: [['people', 'news'], ['show', 'edit']]
|
80
79
|
|
81
80
|
# For matching specific controllers and actions:
|
82
|
-
active_link_to 'User Edit', edit_user_path(@user), :
|
81
|
+
active_link_to 'User Edit', edit_user_path(@user), active: [people: :show, news: :edit]
|
83
82
|
|
84
83
|
# for matching all actions under given controllers:
|
85
84
|
active_link_to 'User Edit', edit_user_path(@user), active: [['people', 'news'], []]
|
@@ -97,7 +96,7 @@ active_link_to 'Users', users_path, active: true
|
|
97
96
|
If we need to set link to be active based on `params`, we can do that as well:
|
98
97
|
|
99
98
|
```ruby
|
100
|
-
active_link_to 'Admin users', users_path(role_eq: 'admin'), :
|
99
|
+
active_link_to 'Admin users', users_path(role_eq: 'admin'), active: { role_eq: 'admin' }
|
101
100
|
```
|
102
101
|
|
103
102
|
## More Options
|
@@ -10,15 +10,10 @@ module ActiveLinkTo
|
|
10
10
|
# active_link_to('/users', class_active: 'enabled')
|
11
11
|
# active_link_to(users_path, active: :exclusive, wrap_tag: :li)
|
12
12
|
def active_link_to(*args, &block)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
else
|
18
|
-
name = args[0]
|
19
|
-
options = args[1] || {}
|
20
|
-
html_options = args[2] || {}
|
21
|
-
end
|
13
|
+
name = block_given? ? capture(&block) : args.shift
|
14
|
+
options = args.shift || {}
|
15
|
+
html_options = args.shift || {}
|
16
|
+
|
22
17
|
url = url_for(options)
|
23
18
|
|
24
19
|
active_options = { }
|
@@ -118,4 +113,6 @@ module ActiveLinkTo
|
|
118
113
|
end
|
119
114
|
end
|
120
115
|
|
121
|
-
|
116
|
+
ActiveSupport.on_load :action_view do
|
117
|
+
include ActiveLinkTo
|
118
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_link_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.6.11
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: ActionView helper to render currently active links
|