Class: Netzke::TreePanel
- Inherits:
-
Base
- Object
- Base
- Netzke::TreePanel
- Defined in:
- lib/netzke/tree_panel.rb
Class Method Summary collapse
Instance Method Summary collapse
- #actions ⇒ Object
- #bbar ⇒ Object
- #get_children(params) ⇒ Object
- #menu ⇒ Object
- #tbar ⇒ Object
- #tools ⇒ Object
Class Method Details
.js_base_class ⇒ Object
4 5 6 |
# File 'lib/netzke/tree_panel.rb', line 4 def self.js_base_class "Ext.tree.TreePanel" end |
.js_common_config_for_constructor ⇒ Object
8 9 10 11 12 13 |
# File 'lib/netzke/tree_panel.rb', line 8 def self.js_common_config_for_constructor super.merge({ :root => {:text => '/', :id => 'source'}, :loader => {:data_url => "config.api.getChildren".l} }) end |
.js_extend_properties ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/netzke/tree_panel.rb', line 15 def self.js_extend_properties { :refresh_handler => <<-END_OF_JAVASCRIPT.l, :add_handler => <<-END_OF_JAVASCRIPT.l, :edit_handler => <<-END_OF_JAVASCRIPT.l, :delete_handler => <<-END_OF_JAVASCRIPT.l function(e){ console.info(e); } END_OF_JAVASCRIPT } end |
Instance Method Details
#actions ⇒ Object
45 46 47 48 49 50 |
# File 'lib/netzke/tree_panel.rb', line 45 def actions { :add => {:text => 'Add'}, :edit => {:text => 'Edit'}, :del => {:text => 'Delete', :disabled => true} } end |
#bbar ⇒ Object
52 53 54 |
# File 'lib/netzke/tree_panel.rb', line 52 def persistent_config[:bbar] ||= config[:bbar] == false ? nil : config[:bbar] || %w{ add edit delete } end |
#get_children(params) ⇒ Object
68 69 70 71 72 |
# File 'lib/netzke/tree_panel.rb', line 68 def get_children(params) klass = config[:data_class_name].constantize node = params[:node] == 'source' ? klass.find_by_parent_id(nil) : klass.find(params[:node].to_i) node.children.map{|n| {:text => n.name, :id => n.id}} end |
#menu ⇒ Object
64 65 66 |
# File 'lib/netzke/tree_panel.rb', line 64 def persistent_config[:menu] ||= config[:menu] == false ? nil : config[:menu] # || [{:text => 'Button', :menu => ['edit', {:text => 'Submenu', :menu => ['delete']}]}] end |
#tbar ⇒ Object
60 61 62 |
# File 'lib/netzke/tree_panel.rb', line 60 def persistent_config[:tbar] ||= config[:tbar] == false ? nil : config[:tbar] end |
#tools ⇒ Object
56 57 58 |
# File 'lib/netzke/tree_panel.rb', line 56 def tools persistent_config[:tools] ||= config[:tools] == false ? nil : config[:tools] #|| %w{ gear refresh } end |