Class: Adva::View::Menu
- Inherits:
-
Minimal::Template
- Object
- Minimal::Template
- Adva::View::Menu
show all
- Defined in:
- lib/adva/view/menu.rb,
lib/adva/view/menu/admin.rb
Defined Under Namespace
Classes: Admin
Instance Method Summary
collapse
Instance Method Details
#item(text, url = nil, options = {}, &block) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/adva/view/menu.rb', line 6
def item(text, url = nil, options = {}, &block)
options.merge!(:class => text.to_s.gsub('.', '')) if text.is_a?(Symbol)
url = url_for(url) unless url.is_a?(String)
li(:class => active?(url, options) ? 'active' : nil) do
options[:type] == :label ? h4(text, options) : link_to(text, url, options)
self << capture { instance_eval(&block) } if block_given?
end
end
|
#label(text, url = nil, options = {}, &block) ⇒ Object
15
16
17
|
# File 'lib/adva/view/menu.rb', line 15
def label(text, url = nil, options = {}, &block)
item(text, url, options.merge(:type => :label), &block)
end
|
#link(text, url = '#', options = {}, &block) ⇒ Object
19
20
21
|
# File 'lib/adva/view/menu.rb', line 19
def link(text, url = '#', options = {}, &block)
item(text, url, options.merge(:type => :link), &block)
end
|