Class: Aureus::Components::Navigation

Inherits:
Renderable
  • Object
show all
Defined in:
lib/aureus/components/navigation.rb

Instance Method Summary collapse

Methods inherited from Renderable

#compact, #compact_render, #content_tag, #init

Constructor Details

#initializeNavigation

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

#button(content) ⇒ Object



16
17
18
# File 'lib/aureus/components/navigation.rb', line 16

def button content
  @buttons << NavigationButton.new(content)
end

#renderObject



26
27
28
29
30
# File 'lib/aureus/components/navigation.rb', line 26

def render
   'div', class: 'aureus-navigation' do
    compact ('h2', ('span',@title)), ('ul', compact_render(*@buttons), id: 'quicklinks')
  end
end

#submit_form_button(resource, text) ⇒ Object



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 =  '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