rails_navigation 0.0.2 → 0.0.3
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 +4 -4
- data/.rspec +4 -0
- data/.travis.yml +13 -0
- data/README.md +10 -0
- data/Rakefile +2 -2
- data/app/helpers/rails_navigation_helper.rb +13 -2
- data/lib/rails_navigation/railtie.rb +1 -1
- data/lib/rails_navigation/version.rb +1 -1
- data/rails_navigation.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9942c7ddd035e87ca87856c3826b282bee593665
|
4
|
+
data.tar.gz: ae70e157ba9a2e5cf8487792b9182ec2dde6ea76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eafa5c67032c2342fdca9065d2b41797250e402b4e255f9c27715e7ba3d605c668537f8f9af6ae39195e0d423ac846286381126d84d809843a3313dcc70b8efd
|
7
|
+
data.tar.gz: 3b5bd2e5b7a72c8367a0739c5e0676306b65b22f076b27ff98c4916ec736432fab05d1b90483e8ebbd4f3155733401f112b868fbe83fcf7a15a46b9d8548d2b4
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](http://badge.fury.io/rb/rails_navigation) [](https://travis-ci.org/rails-components/rails_navigation) [](https://codeclimate.com/github/rails-components/rails_navigation)
|
2
|
+
|
1
3
|
# rails_navigation
|
2
4
|
|
3
5
|
Simplify matching of Rails routes. You are unhappy with the [`link_to_if`](http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to_if)
|
@@ -82,6 +84,14 @@ Or even simpler (id is the default):
|
|
82
84
|
## TODO
|
83
85
|
|
84
86
|
* support `not` operator
|
87
|
+
* html options for inner link element
|
88
|
+
|
89
|
+
|
90
|
+
## Maintainers
|
91
|
+
|
92
|
+
* Sascha Brink (https://github.com/sbrink)
|
93
|
+
* Martin Schurig (https://github.com/schurig)
|
94
|
+
|
85
95
|
|
86
96
|
## Contributing
|
87
97
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'bundler/gem_tasks'
|
|
4
4
|
# Default directory to look in is `/specs`
|
5
5
|
# Run with `rake spec`
|
6
6
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
-
task.rspec_opts = ['--color', '--format', '
|
7
|
+
task.rspec_opts = ['--color', '--format', 'documentation']
|
8
8
|
end
|
9
9
|
|
10
|
-
task default: :spec
|
10
|
+
task default: :spec
|
@@ -3,7 +3,18 @@ module RailsNavigationHelper
|
|
3
3
|
RailsNavigation::Matcher.match_multiple_with_or?(controller_name, action_name, params, conditions)
|
4
4
|
end
|
5
5
|
|
6
|
-
def nav_to(name, path, conditions = nil)
|
7
|
-
|
6
|
+
def nav_to(name, path, conditions = nil, html_options = {})
|
7
|
+
active_class = []
|
8
|
+
active_class = ['active'] if matches_page?(conditions)
|
9
|
+
|
10
|
+
if html_options[:class]
|
11
|
+
custom_classes = *html_options[:class]
|
12
|
+
classes = active_class + custom_classes
|
13
|
+
else
|
14
|
+
classes = active_class
|
15
|
+
end
|
16
|
+
|
17
|
+
html_options[:class] = classes
|
18
|
+
content_tag(:li, link_to(name, path), html_options)
|
8
19
|
end
|
9
20
|
end
|
data/rails_navigation.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['sascha.brink@gmail.com', 'martin@schurig.pw']
|
11
11
|
spec.summary = %q{Simplified navigation helper for Rails.}
|
12
12
|
spec.description = spec.summary
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/rails-components/rails_navigation'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sascha Brink
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -146,6 +146,8 @@ extensions: []
|
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
148
|
- ".gitignore"
|
149
|
+
- ".rspec"
|
150
|
+
- ".travis.yml"
|
149
151
|
- Gemfile
|
150
152
|
- Guardfile
|
151
153
|
- LICENSE.txt
|
@@ -159,7 +161,7 @@ files:
|
|
159
161
|
- rails_navigation.gemspec
|
160
162
|
- spec/rails_navigation_spec.rb
|
161
163
|
- spec/spec_helper.rb
|
162
|
-
homepage: https://github.com/
|
164
|
+
homepage: https://github.com/rails-components/rails_navigation
|
163
165
|
licenses:
|
164
166
|
- MIT
|
165
167
|
metadata: {}
|
@@ -179,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
181
|
version: '0'
|
180
182
|
requirements: []
|
181
183
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.5
|
183
185
|
signing_key:
|
184
186
|
specification_version: 4
|
185
187
|
summary: Simplified navigation helper for Rails.
|