rails_navigation 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f58a4745dfc48238bd43a08be6e3b12f959ca556
4
- data.tar.gz: d9b27e8707cc331fcce6f61fea6e62f819f50260
3
+ metadata.gz: 9942c7ddd035e87ca87856c3826b282bee593665
4
+ data.tar.gz: ae70e157ba9a2e5cf8487792b9182ec2dde6ea76
5
5
  SHA512:
6
- metadata.gz: 1c104d54fd50cb0e4b11814dea82aec78b174af7a61a35c307f953eedd858b032cebd9426c292cac11e4a77d73691adfa63ab1c2c9201cad376ae598bddc7465
7
- data.tar.gz: b542b987886d6c619025b4b24578fd82807eb4075a49567ba656fe862d512fae9ac83b74c7454a925c32715ad245eadb485e368e607e339bbd4bed8cf644cd19
6
+ metadata.gz: eafa5c67032c2342fdca9065d2b41797250e402b4e255f9c27715e7ba3d605c668537f8f9af6ae39195e0d423ac846286381126d84d809843a3313dcc70b8efd
7
+ data.tar.gz: 3b5bd2e5b7a72c8367a0739c5e0676306b65b22f076b27ff98c4916ec736432fab05d1b90483e8ebbd4f3155733401f112b868fbe83fcf7a15a46b9d8548d2b4
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --format doc
4
+ --format Nc
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem install bundler -v '>= 1.5.1'
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1
8
+ - 2.2
9
+ - jruby
10
+ gemfile:
11
+ - Gemfile
12
+ notifications:
13
+ email: false
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/rails_navigation.svg)](http://badge.fury.io/rb/rails_navigation) [![Build Status](https://travis-ci.org/rails-components/rails_navigation.svg?branch=master)](https://travis-ci.org/rails-components/rails_navigation) [![Code Climate](https://codeclimate.com/github/rails-components/rails_navigation/badges/gpa.svg)](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', 'nested']
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
- content_tag :li, link_to(name, path), class: ('active' if matches_page?(conditions))
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
@@ -1,4 +1,4 @@
1
1
  module RailsNavigation
2
2
  class Engine < ::Rails::Engine
3
3
  end
4
- end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsNavigation
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -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/sbrink/rails_navigation'
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.2
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-01-16 00:00:00.000000000 Z
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/sbrink/rails_navigation
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.2.2
184
+ rubygems_version: 2.4.5
183
185
  signing_key:
184
186
  specification_version: 4
185
187
  summary: Simplified navigation helper for Rails.