Class: Aureus::Components::Navigation
Instance Method Summary
collapse
Methods inherited from Renderable
#compact, #compact_render, #content_tag, #init
Constructor Details
Returns a new instance of Navigation.
7
8
9
10
|
# File 'lib/aureus/components/navigation.rb', line 7
def initialize
@title = ''
@buttons = Array.new
end
|
Instance Method Details
16
17
18
|
# File 'lib/aureus/components/navigation.rb', line 16
def button content
@buttons << NavigationButton.new(content)
end
|
#render ⇒ Object
26
27
28
29
30
|
# File 'lib/aureus/components/navigation.rb', line 26
def render
content_tag 'div', class: 'aureus-navigation' do
compact content_tag('h2', content_tag('span',@title)), content_tag('ul', compact_render(*@buttons), id: 'quicklinks')
end
end
|
20
21
22
23
24
|
# File 'lib/aureus/components/navigation.rb', line 20
def submit_form_button resource, text
form_class = resource.is_a?(String) ? resource : resource.class.name.underscore
tag = content_tag 'a', text, onclick: "aureus_trigger_form('form.#{form_class}')", class: 'submit_form_button'
@buttons << NavigationButton.new(tag)
end
|
#title(title) ⇒ Object
12
13
14
|
# File 'lib/aureus/components/navigation.rb', line 12
def title title
@title = title
end
|