Class: Lipsiadmin::Ext::Button
- Defined in:
- lib/view/helpers/ext/button.rb
Overview
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"
# }]
#}
. :text => "Backend.locale.buttons.add".to_l, :id => "add", :disabled => false, :cls => "x-btn-text-icon add", :handler => "add".to_l
. :text => "Backend.locale.buttons.edit".to_l, :id => "edit", :disabled => true, :cls => "x-btn-text-icon edit", :handler => "edit".to_l
. :text => "Backend.locale.buttons.remove".to_l, :id => "remove", :disabled => true, :cls => "x-btn-text-icon remove", :handler => "remove".to_l
. :text => "Backend.locale.buttons.print".to_l, :id => "print", :disabled => false, :cls => "x-btn-text-icon print" do ||
. :text => "Test Me"
. :text => "IM a sub Menu"
end
Instance Method Summary collapse
-
#add_button(options, &block) ⇒ Object
Add new Button to the menu of this one.
-
#initialize(options = {}) {|_self| ... } ⇒ Button
constructor
:nodoc:.
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| ... } ⇒ Button
:nodoc:
46 47 48 49 |
# File 'lib/view/helpers/ext/button.rb', line 46 def initialize(={}, &block)#:nodoc: super("Ext.Button", ) 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 Button to the menu of this one
# Generates: { handler: show, text: "Add", other: "...", icon: "..." }
:text => "Add", :handler => "show".to_l, :icon => "...", :other => "..."
56 57 58 59 |
# File 'lib/view/helpers/ext/button.rb', line 56 def (, &block) config[:menu] ||= [] config[:menu] << (.is_a?(String) ? : Button.new(, &block).config) end |