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.



10
11
12
13
14
15
16
17
# File 'lib/tao_ui/components/tree_component.rb', line 10

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.



8
9
10
# File 'lib/tao_ui/components/tree_component.rb', line 8

def children_key
  @children_key
end

#expandedObject (readonly)

Returns the value of attribute expanded.



8
9
10
# File 'lib/tao_ui/components/tree_component.rb', line 8

def expanded
  @expanded
end

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/tao_ui/components/tree_component.rb', line 8

def items
  @items
end

#remoteObject (readonly)

Returns the value of attribute remote.



8
9
10
# File 'lib/tao_ui/components/tree_component.rb', line 8

def remote
  @remote
end

#selectableObject (readonly)

Returns the value of attribute selectable.



8
9
10
# File 'lib/tao_ui/components/tree_component.rb', line 8

def selectable
  @selectable
end

Class Method Details

.component_nameObject



31
32
33
# File 'lib/tao_ui/components/tree_component.rb', line 31

def self.component_name
  :tree
end

Instance Method Details

#render(&block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tao_ui/components/tree_component.rb', line 19

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