simple-navigation 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ *3.0.2
2
+
3
+ * dom_id and dom_class can now be set as option in the item's definition (useful for dynamic menu items).
4
+
1
5
  *3.0.1
2
6
 
3
7
  * allow controller instance variables named @template for rails3 apps. Credits to cmartyn.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.1
1
+ 3.0.2
@@ -10,6 +10,8 @@ module SimpleNavigation
10
10
  # The subnavigation (if any) is either provided by a block or passed in directly as <tt>items</tt>
11
11
  def initialize(container, key, name, url, options, items=nil, &sub_nav_block)
12
12
  @container = container
13
+ @container.dom_class = options.delete(:container_class) if options[:container_class]
14
+ @container.dom_id = options.delete(:container_id) if options[:container_id]
13
15
  @key = key
14
16
  @method = options.delete(:method)
15
17
  @name = name
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe SimpleNavigation::Item do
4
4
 
5
5
  before(:each) do
6
- @item_container = stub(:item_container, :level => 1)
6
+ @item_container = stub(:item_container, :level => 1).as_null_object
7
7
  @item = SimpleNavigation::Item.new(@item_container, :my_key, 'name', 'url', {})
8
8
  @adapter = stub(:adapter)
9
9
  SimpleNavigation.stub!(:adapter => @adapter)
@@ -67,6 +67,17 @@ describe SimpleNavigation::Item do
67
67
  end
68
68
  end
69
69
  end
70
+
71
+ context 'setting class and id on the container' do
72
+ before(:each) do
73
+ @options = {:container_class => 'container_class', :container_id => 'container_id'}
74
+ end
75
+ it {@item_container.should_receive(:dom_class=).with('container_class')}
76
+ it {@item_container.should_receive(:dom_id=).with('container_id')}
77
+ after(:each) do
78
+ SimpleNavigation::Item.new(@item_container, :my_key, 'name', 'url', @options)
79
+ end
80
+ end
70
81
 
71
82
  context ':highlights_on option' do
72
83
  context 'defined' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 1
10
- version: 3.0.1
9
+ - 2
10
+ version: 3.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andi Schacke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-26 00:00:00 +02:00
18
+ date: 2010-11-01 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency