class TaoUi::Components::Tree::ListComponent

Attributes

children_key[R]
depth[R]
expanded[R]
items[R]
remote[R]
selectable[R]
selected[R]

Public Class Methods

component_name() click to toggle source
# File lib/tao_ui/components/tree/list_component.rb, line 37
def self.component_name
  :tree_list
end
new(view, items, options = {}) click to toggle source
Calls superclass method
# 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

Public Instance Methods

render(&block) click to toggle source
# File lib/tao_ui/components/tree/list_component.rb, line 20
def render &block
  view.content_tag '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

Private Instance Methods

default_options() click to toggle source
# File lib/tao_ui/components/tree/list_component.rb, line 43
def default_options
  {class: 'tao-tree-list', children_key: :children, depth: 0}
end