menu_builder 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -5,13 +5,13 @@ in controller. Easy like always should be!
5
5
 
6
6
  == Instalation
7
7
 
8
- As a Rail2.1+ gem
8
+ Rail2
9
9
 
10
- gem.config "menu_builder"
11
-
12
- As Rails plugin
10
+ gem.config "menu_builder", :version => '0.2.1'
11
+
12
+ Rails3
13
13
 
14
- ruby script/plugin install git://github.com/danielvlopes/menu_builder.git
14
+ gem "menu_builder", '>=0.2.2'
15
15
 
16
16
  == Usage
17
17
 
@@ -30,7 +30,7 @@ Just install the plugin and see the example below:
30
30
 
31
31
  ==== ERB code
32
32
 
33
- <% menu(:id=>"mainMenu", :class=>"menu") do |m| %>
33
+ <%= menu(:id=>"mainMenu", :class=>"menu") do |m| %>
34
34
  <%= m.account 'Account', account_path, :style => 'float: right' %>
35
35
  <%= m.users 'Users', users_path, :style => 'float: right' %>
36
36
  <%= m.mydashboard 'Dashboard', '/' %>
@@ -51,7 +51,7 @@ Just install the plugin and see the example below:
51
51
  Also is possible to pass blocks instead of simple strings for content.
52
52
  In this way you can create menu item with icons. Like below:
53
53
 
54
- <% menu do |m| %>
54
+ <%= menu do |m| %>
55
55
  <% m.account account_path do %>
56
56
  <%= image_tag "icon.jpg" /> Accounts
57
57
  <% end %>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -18,16 +18,8 @@ module MenuBuilder
18
18
 
19
19
  end
20
20
 
21
- def menu(options={})
22
- concat tag(:ul, options, true)
23
- yield Menu.new(self)
24
- concat safe_html("</ul>")
21
+ def menu(options={}, &block)
22
+ content_tag :ul, capture(Menu.new(self), &block), options
25
23
  end
26
-
27
- private
28
- def safe_html(html)
29
- html.respond_to?(:html_safe) ? html.html_safe : html
30
- end
31
-
32
24
  end
33
25
  end
data/menu_builder.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{menu_builder}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Lopes"]
12
- s.date = %q{2010-03-20}
12
+ s.date = %q{2010-06-23}
13
13
  s.description = %q{ helper and controller macros to define current menu item and also create the menu in view. }
14
14
  s.email = %q{danielvlopes@gmail.com}
15
15
  s.extra_rdoc_files = [
data/test/helper_test.rb CHANGED
@@ -4,39 +4,39 @@ class HelperTest < ActionView::TestCase
4
4
  tests MenuBuilder::ViewHelpers
5
5
 
6
6
  test "menu yields an instance of Menu" do
7
- menu do |m|
7
+ concat(menu do |m|
8
8
  assert m.instance_of?(MenuBuilder::ViewHelpers::Menu)
9
- end
9
+ end)
10
10
  end
11
11
 
12
12
  test "menu create an unordered list" do
13
- menu :id=>"menu" do |m| end
13
+ concat(menu(:id => "menu") { |m| })
14
14
  assert_select "ul#menu"
15
15
  end
16
-
16
+
17
17
  test "menu should accept html options like classes and id" do
18
- menu :id=>"menu", :class=>"tabs" do |m| end
18
+ concat(menu :id=>"menu", :class=>"tabs" do |m| end)
19
19
  assert_select "ul#menu.tabs"
20
20
  end
21
-
21
+
22
22
  test "menu should create a line item" do
23
- menu { |m| concat m.home "Home", "#" }
23
+ concat(menu { |m| concat m.home "Home", "#" })
24
24
  assert_select "li", 1
25
25
  end
26
-
26
+
27
27
  test "should create a link inside line item" do
28
- menu { |m| concat m.home "Home", "/" }
28
+ concat(menu { |m| concat m.home "Home", "/" })
29
29
  expected = %(<ul><li><a href="/">Home</a></li></ul>)
30
30
  assert_dom_equal expected, output_buffer
31
31
  end
32
-
32
+
33
33
  test "should set the class to the current item li" do
34
34
  @menu_item = :home
35
- menu do |m|
35
+ concat(menu do |m|
36
36
  concat m.home "Home", "/"
37
37
  concat m.contact "Store", "/store"
38
- end
39
-
38
+ end)
39
+
40
40
  assert_select "li.current", 1
41
41
  end
42
42
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Lopes
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-20 00:00:00 -03:00
17
+ date: 2010-06-23 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20