Class: TaoUi::Components::TreeComponent

Inherits:
TaoOnRails::Components::Base
  • Object
show all
Defined in:
lib/tao_ui/components/tree_component.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, items, options = {}) ⇒ TreeComponent

Returns a new instance of TreeComponent.



7
8
9
10
11
12
13
14
# File 'lib/tao_ui/components/tree_component.rb', line 7

def initialize view, items, options = {}
  super view,options
  @items = items
  @children_key = @options.delete(:children_key)
  @selectable = @options[:selectable] || false
  @remote = @options.delete(:remote)
  @expanded = @options.delete(:expanded)
end

Instance Attribute Details

#children_keyObject (readonly)

Returns the value of attribute children_key.



5
6
7
# File 'lib/tao_ui/components/tree_component.rb', line 5

def children_key
  @children_key
end

#expandedObject (readonly)

Returns the value of attribute expanded.



5
6
7
# File 'lib/tao_ui/components/tree_component.rb', line 5

def expanded
  @expanded
end

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/tao_ui/components/tree_component.rb', line 5

def items
  @items
end

#remoteObject (readonly)

Returns the value of attribute remote.



5
6
7
# File 'lib/tao_ui/components/tree_component.rb', line 5

def remote
  @remote
end

#selectableObject (readonly)

Returns the value of attribute selectable.



5
6
7
# File 'lib/tao_ui/components/tree_component.rb', line 5

def selectable
  @selectable
end

Class Method Details

.component_nameObject



28
29
30
# File 'lib/tao_ui/components/tree_component.rb', line 28

def self.component_name
  :tree
end

Instance Method Details

#render(&block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tao_ui/components/tree_component.rb', line 16

def render &block
  view. tag_name, html_options do
    view.tao_tree_list items, {
      depth: 0,
      selectable: selectable,
      remote: remote,
      expanded: expanded,
      children_key: children_key
    }, &block
  end
end