Class: TaoUi::Components::Tree::ListComponent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ListComponent.



9
10
11
12
13
14
15
16
17
18
# File 'lib/tao_ui/components/tree/list_component.rb', line 9

def initialize view, items, options = {}
  super view, options
  @items = items
  @children_key = @options.delete(:children_key)
  @selectable = @options.delete(:selectable)
  @selected = @options.delete(:selected)
  @remote = @options.delete(:remote)
  @expanded = @options.delete(:expanded)
  @depth = @options.delete(:depth)
end

Instance Attribute Details

#children_keyObject (readonly)

Returns the value of attribute children_key.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def children_key
  @children_key
end

#depthObject (readonly)

Returns the value of attribute depth.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def depth
  @depth
end

#expandedObject (readonly)

Returns the value of attribute expanded.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def expanded
  @expanded
end

#itemsObject (readonly)

Returns the value of attribute items.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def items
  @items
end

#remoteObject (readonly)

Returns the value of attribute remote.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def remote
  @remote
end

#selectableObject (readonly)

Returns the value of attribute selectable.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def selectable
  @selectable
end

#selectedObject (readonly)

Returns the value of attribute selected.



6
7
8
# File 'lib/tao_ui/components/tree/list_component.rb', line 6

def selected
  @selected
end

Class Method Details

.component_nameObject



37
38
39
# File 'lib/tao_ui/components/tree/list_component.rb', line 37

def self.component_name
  :tree_list
end

Instance Method Details

#render(&block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tao_ui/components/tree/list_component.rb', line 20

def render &block
  view. 'div', html_options do
    if items && items.size > 0
      items.each do |item|
        view.concat view.tao_tree_item item, {
          children_key: children_key,
          selectable: selectable,
          selected: selected,
          depth: depth,
          remote: remote,
          expanded: expanded
        }, &block
      end
    end
  end
end