Generate a new Ext.Button
This component is usefull for ex in toolbars
# Generates:
#{
# buttons: [{
# disabled: false,
# text: Backend.locale.buttons.add,
# id: "add",
# cls: "x-btn-text-icon add"
# },{
# disabled: true,
# text: Backend.locale.buttons.edit,
# id: "edit",
# cls: "x-btn-text-icon edit"
# },{
# disabled: true,
# text: Backend.locale.buttons.remove,
# id: "remove",
# cls: "x-btn-text-icon remove"
# },{
# disabled: false,
# menu: [{
# text: "Test Me"
# },{
# text: "IM a sub Menu"
# }],
# text: Backend.locale.buttons.print,
# id: "print",
# cls: "x-btn-text-icon print"
# }]
#}
tbar.add_button :text => "Backend.locale.buttons.add".to_l, :id => "add", :disabled => false, :cls => "x-btn-text-icon add", :handler => "add".to_l
tbar.add_button :text => "Backend.locale.buttons.edit".to_l, :id => "edit", :disabled => true, :cls => "x-btn-text-icon edit", :handler => "edit".to_l
tbar.add_button :text => "Backend.locale.buttons.remove".to_l, :id => "remove", :disabled => true, :cls => "x-btn-text-icon remove", :handler => "remove".to_l
tbar.add_button :text => "Backend.locale.buttons.print".to_l, :id => "print", :disabled => false, :cls => "x-btn-text-icon print" do |menu|
menu.add_button :text => "Test Me"
menu.add_button :text => "IM a sub Menu"
end
Methods
Public Instance methods
Add new Button to the menu of this one
# Generates: { handler: show, text: "Add", other: "...", icon: "..." }
add_button :text => "Add", :handler => "show".to_l, :icon => "...", :other => "..."
[ show source ]
# File lib/view/helpers/ext/button.rb, line 56
56: def add_button(options, &block)
57: config[:menu] ||= []
58: config[:menu] << (options.is_a?(String) ? options : Button.new(options, &block).config)
59: end