navigasmic 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ module Navigasmic::Builder
24
24
  @highlighted_class = 'active'
25
25
 
26
26
  # generator callbacks
27
- @link_generator = proc{ |label, link, options, is_nested| link_to(label, link, options.delete(:link_html)) }
27
+ @link_generator = proc{ |label, link, options, is_nested| link_to(label, link, options) }
28
28
  @label_generator = proc{ |label, is_linked, is_nested| "<span>#{label}</span>" }
29
29
 
30
30
  super
@@ -100,8 +100,12 @@ module Navigasmic::Builder
100
100
  @context.send(path_helper) if @context.respond_to?(path_helper)
101
101
  elsif link.is_a?(Proc)
102
102
  eval_in_context(&link)
103
- else
103
+ elsif link.is_a?(String)
104
+ link
105
+ elsif link.is_a?(Hash)
104
106
  link
107
+ else
108
+ url_for(link)
105
109
  end
106
110
  end
107
111
 
@@ -10,7 +10,11 @@ module Navigasmic::ViewHelpers
10
10
  # <% end %>
11
11
  # <% end %>
12
12
  def semantic_navigation(name, options = {}, &block)
13
-
13
+ if name.is_a?(Hash)
14
+ options = name
15
+ options[:id] ||= nil
16
+ name = ""
17
+ end
14
18
  builder = options.delete(:builder) || Navigasmic.configuration.default_builder
15
19
  builder.new(self, name, options, &block).render
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Navigasmic
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -62,5 +62,23 @@ describe 'Navigasmic::Builder::ListBuilder', type: :helper do
62
62
 
63
63
  builder.render.should match(clean(html))
64
64
  end
65
+
66
+ it "handles link_html of items" do
67
+ builder = subject.new helper, :primary, {} do |n|
68
+ n.item('Level 1', 'level1.html', class: 'item', link_html: {class: "dialog"})
69
+ end
70
+
71
+ html = <<-HTML
72
+ <ul class="semantic-navigation" id="primary">
73
+ <li class="item">
74
+ <a href="level1.html" class="dialog">
75
+ <span>Level 1</span>
76
+ </a>
77
+ </li>
78
+ </ul>
79
+ HTML
80
+
81
+ builder.render.should match(clean(html))
82
+ end
65
83
  end
66
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigasmic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  segments:
123
123
  - 0
124
- hash: 4331876644713175306
124
+ hash: -2130130245475207241
125
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  none: false
127
127
  requirements:
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: 4331876644713175306
133
+ hash: -2130130245475207241
134
134
  requirements: []
135
135
  rubyforge_project:
136
136
  rubygems_version: 1.8.24