Class: Lipsiadmin::Ext::ToolBar

Inherits:
Component show all
Defined in:
lib/view/helpers/ext/tool_bar.rb

Overview

Generate a new Ext.Toolbar

Examples:

  var toolBar = new Ext.Toolbar([{
      handler: show,
      text: "Add",
      other: "...",
      icon: "..."
    },{
      handler: Backend.app.loadHtml('/accounts/'+accounts_grid.getSelected().id+'/edit'),
      text: "Edit",
      other: "..."
  }]);

grid.tbar do |bar|
  bar.add "Add",  :handler => "show".to_l, :icon => "...", :other => "..."
  bar.add "Edit", :handler => "Backend.app.loadHtml('/accounts/'+accounts_grid.getSelected().id+'/edit')".to_l, :other => "..."
end

Instance Method Summary collapse

Methods inherited from Component

#add, #after, #before, #config, #config=, #get_var, #id, #method_missing, #on, #prefix=, #raise_error, #title, #to_s, #un, #var, #with_output_buffer

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ ToolBar

:nodoc:

Yields:

  • (_self)

Yield Parameters:



25
26
27
28
# File 'lib/view/helpers/ext/tool_bar.rb', line 25

def initialize(options={}, &block)#:nodoc:
  super("Ext.Toolbar", { :buttons => [] }.merge(options))
  yield self if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lipsiadmin::Ext::Component

Instance Method Details

#add_button(options, &block) ⇒ Object

Add new items to a Ext.Toolbar

# Generates: { handler: show, text: "Add", other: "...", icon: "..." }
add_button :text => "Add",  :handler => "show".to_l, :icon => "...", :other => "..."


35
36
37
# File 'lib/view/helpers/ext/tool_bar.rb', line 35

def add_button(options, &block)
  config[:buttons] << (options.is_a?(String) ? options : Button.new(options, &block).config)
end