Class: QUI::Toolbar::Base

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
Defined in:
lib/qui-toolbar-base.rb

Instance Method Summary collapse

Constructor Details

#initialize(binding) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/qui-toolbar-base.rb', line 8

def initialize(binding)
  @binding = binding
  @controller = eval("controller", @binding)
end

Instance Method Details

#createObject



13
14
15
# File 'lib/qui-toolbar-base.rb', line 13

def create
  add_toolbar_link_to({ :controller =>controller_name, :action => "new" }, :action => :create)
end

#custom(options = {}) ⇒ Object



29
30
31
# File 'lib/qui-toolbar-base.rb', line 29

def custom(options = {})
  options[:content]
end

#deleteObject



21
22
23
# File 'lib/qui-toolbar-base.rb', line 21

def delete
  add_toolbar_link_to({ :controller => controller_name, :action => "destroy" }, { :link_options => { :confirm => true, :method => :delete }, :action => :delete })
end

#editObject



17
18
19
# File 'lib/qui-toolbar-base.rb', line 17

def edit
  add_toolbar_link_to({ :controller => controller_name, :action => "edit" }, :action => :edit)
end

#indexObject



25
26
27
# File 'lib/qui-toolbar-base.rb', line 25

def index
  add_toolbar_link_to({ :controller => controller_name, :action => "index" }, { :action => :index })
end

#separatorObject



33
34
35
# File 'lib/qui-toolbar-base.rb', line 33

def separator
  (:div, "", :class => "separator")
end