activemenu 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/README.md +9 -7
- data/lib/active_menu/menu.rb +1 -10
- data/lib/active_menu/version.rb +1 -1
- data/spec/lib/active_menu/menu_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8558f5943cf6c95a8b783b3295c5282d861dcb9
|
4
|
+
data.tar.gz: b4a62ed3d275d52ee36dc612806523791b15448f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75825a780ecba66a6c04f6f42f559f1ccdab68873a541d9e175f430bca0424806b005eabaf214e0189a8a1004bd8a502076d933da6e82fbc100c50650b3b2da3
|
7
|
+
data.tar.gz: 705f75e65f15ea546ad8ad315d4db989a1e2f74b09155a6eeb771fa512736eec2f0037f8c7a81828115518af88dde30c139b6d829825dc5b26bdaf0007caa72c
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ These options are write to a hash, that you can use with other gem to render it.
|
|
68
68
|
|
69
69
|
To facilitate the creating of menus, there are some methods to help you organize the options standard.
|
70
70
|
|
71
|
-
### tag(
|
71
|
+
### tag(value=nil)
|
72
72
|
You can set the tag for the menu element or can retrieve it.
|
73
73
|
```ruby
|
74
74
|
@menu = ActiveMenu::get(:my_menu)
|
@@ -78,14 +78,16 @@ You can set the tag for the menu element or can retrieve it.
|
|
78
78
|
@menu.tag # --> :div
|
79
79
|
```
|
80
80
|
|
81
|
+
### text()
|
82
|
+
|
81
83
|
### Nested menus
|
82
84
|
```ruby
|
83
|
-
@menu = ActiveMenu::Menu.new(:mainmenu, 'http://example.com')
|
84
|
-
# def initialize(id,
|
85
|
-
@menu.submenu(:mysubmenu, "test") do |sm|
|
86
|
-
sm.
|
87
|
-
sm.submenu(:mysubsubmenu, 'test 2') do |ssm|
|
88
|
-
ssm.
|
85
|
+
@menu = ActiveMenu::Menu.new(:mainmenu, href: 'http://example.com')
|
86
|
+
# def initialize(id, options={}, &block) .... yield(self) if block_given?
|
87
|
+
@menu.submenu(:mysubmenu, href: "test") do |sm|
|
88
|
+
sm.text 'My submenu'
|
89
|
+
sm.submenu(:mysubsubmenu, href:'test 2') do |ssm|
|
90
|
+
ssm.text 'My subsubmenu'
|
89
91
|
end
|
90
92
|
end
|
91
93
|
# Let's improve this DSL, contribute please.
|
data/lib/active_menu/menu.rb
CHANGED
@@ -25,10 +25,6 @@ class ActiveMenu::Menu
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def text=(value)
|
29
|
-
self.text(value)
|
30
|
-
end
|
31
|
-
|
32
28
|
def href(value = nil)
|
33
29
|
if value.nil?
|
34
30
|
@options[:href]
|
@@ -36,12 +32,7 @@ class ActiveMenu::Menu
|
|
36
32
|
value = value.to_sym
|
37
33
|
@options[:href] = value
|
38
34
|
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def href=(value)
|
42
|
-
self.href(value)
|
43
|
-
end
|
44
|
-
|
35
|
+
end
|
45
36
|
|
46
37
|
def tag(value=nil)
|
47
38
|
if value.nil?
|
data/lib/active_menu/version.rb
CHANGED
@@ -40,7 +40,7 @@ describe ActiveMenu::Menu do
|
|
40
40
|
it 'have a flexible DSL for menus' do
|
41
41
|
@menu.submenu(:mysubmenu, text: "test") do |sm|
|
42
42
|
@sm = sm
|
43
|
-
sm.text
|
43
|
+
sm.text 'My submenu'
|
44
44
|
sm.submenu(:mysubsubmenu, text: 'test 2') do |ssm|
|
45
45
|
@ssm = ssm
|
46
46
|
ssm.text == 'My subsubmenu'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemenu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadjow Medeiros Leão
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|