Permalink
Browse files

change the name for current_class on menu helper

  • Loading branch information...
1 parent 9ee48d4 commit a3dcb70c58ad3ca9d3b65ecfa57525e232098893 @danielvlopes committed Apr 15, 2012
Showing with 7 additions and 7 deletions.
  1. +5 −5 lib/menu_builder/helper.rb
  2. +2 −2 test/helper_test.rb
View
10 lib/menu_builder/helper.rb
@@ -1,8 +1,8 @@
module MenuBuilder
module ViewHelpers
def menu(options={}, &block)
- current_item_class = options.delete :current_item_class
- content_tag :ul, Menu.new(self, current_item_class, &block).render, options
+ current_class = options.delete :current_class
+ content_tag :ul, Menu.new(self, current_class, &block).render, options
end
private
@@ -24,9 +24,9 @@ def to_sym
end
class Menu
- def initialize(context, current_item_class="current", &block)
+ def initialize(context, current_class="current", &block)
@context = context
- @current_item_class = current_item_class || "current"
+ @current_class = current_class || "current"
@menu_items = context.instance_variable_get('@menu_items')
@actual_items = []
@block = block
@@ -48,7 +48,7 @@ def render_one item
def html_options_for item
css_classes = []
- css_classes << "#{@current_item_class}" if included_in_current_items? item
+ css_classes << "#{@current_class}" if included_in_current_items? item
css_classes << "first" if first? item
css_classes << "last" if last? item
View
4 test/helper_test.rb
@@ -43,7 +43,7 @@ class HelperTest < ActionView::TestCase
test "customize the current item class" do
@menu_items = [:home]
- concat(menu({:current_item_class => "active"}) { |m|
+ concat(menu({:current_class => "active"}) { |m|
concat m.home "Home", "/"
concat m.contact "Store", "/store"
})
@@ -67,7 +67,7 @@ class HelperTest < ActionView::TestCase
test "accept more than one menu item for a custom current item class" do
@menu_items = [:settings, :notifications]
- concat(menu({:current_item_class => "active"}) { |m|
+ concat(menu({:current_class => "active"}) { |m|
concat m.home "Home", "/"
concat m.notifications "Notifications", "/notifications"
concat m.settings "Settings", "/settings"

0 comments on commit a3dcb70

Please sign in to comment.