nav_link_to 0.0.3 → 0.0.4

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.
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
  nav_link_to 'Home', root_path
22
22
  nav_link_to 'Home', root_path, 'myClass'
23
23
  nav_link_to 'Home', root_path, nil, id:'myId'
24
- # Class is a necessary param if you want to use another attribute after, even if nil
24
+ # Class is a necessary param if you want to use another attribute after, but you can set it 'nil'
25
25
 
26
26
 
27
27
  will return
@@ -2,15 +2,19 @@ require "nav_link_to/version"
2
2
 
3
3
  module NavLinkTo
4
4
 
5
- def nav_link_to(text, path, css_class=nil, properties = {})
5
+ def nav_link_to(text, path, css_class=nil, li_properties = {}, a_properties = {})
6
6
 
7
- p = properties.collect do |k, v|
7
+ lp = li_properties.collect do |k, v|
8
+ %( #{k}="#{v}") unless k == :class
9
+ end.join
10
+
11
+ ap = a_properties.collect do |k, v|
8
12
  %( #{k}="#{v}") unless k == :class
9
13
  end.join
10
14
 
11
15
  tag_class = %( class="#{css_class unless css_class.nil? }#{' ' if current_page? path and !css_class.nil?}#{'active' if current_page? path}") if current_page? path or !css_class.nil?
12
16
 
13
- %(<li#{tag_class}#{p}>#{link_to text, path}</li>).html_safe
17
+ %(<li#{tag_class}#{lp}>#{link_to text, path, a_properties}</li>).html_safe
14
18
 
15
19
  end
16
20
 
@@ -1,3 +1,3 @@
1
1
  module NavLinkTo
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nav_link_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-01 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Create link inside <li> element and gives it a 'active' class if current
15
15
  page
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 1.8.23
50
+ rubygems_version: 1.8.24
51
51
  signing_key:
52
52
  specification_version: 3
53
53
  summary: Create a menu link