Class: Aureus::Components::ToolbarDropdown

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

Instance Method Summary collapse

Methods inherited from Renderable

#compact, #compact_render, #content_tag, #init

Constructor Details

#initialize(title) ⇒ ToolbarDropdown

Returns a new instance of ToolbarDropdown.



97
98
99
100
# File 'lib/aureus/components/toolbar.rb', line 97

def initialize title
  @title = title
  @items = Array.new
end

Instance Method Details

#dividerObject



110
111
112
# File 'lib/aureus/components/toolbar.rb', line 110

def divider
  @items << ToolbarDivider.new
end

#info(text) ⇒ Object



106
107
108
# File 'lib/aureus/components/toolbar.rb', line 106

def info text
  @items << ToolbarInfo.new(text,1)
end


102
103
104
# File 'lib/aureus/components/toolbar.rb', line 102

def link_to text, url, *args
  @items << ToolbarButton.new(text,1,url,args)
end

#renderObject



114
115
116
117
118
# File 'lib/aureus/components/toolbar.rb', line 114

def render
  title =  'span', @title, class: 'dropdown-accessor'
  list =  'ul', compact_render(*@items), class: 'dropdown-inner'
   'li', title+list, class: 'dropdown-outer'
end