Sha256: 7c7c39d40ad756c7130e1c4f18b0b28941477f483483a428d39ee23988b5592b

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

module TaoUi
  module Components
    class TreeComponent < TaoOnRails::Components::Base

      attr_reader :items, :selectable, :children_key, :remote, :expanded

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

      def render &block
        view.content_tag 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

      def self.component_name
        :tree
      end

      private

      def default_options
        {class: 'tao-tree', children_key: :children}
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tao_ui-1.0.0.beta.1 lib/tao_ui/components/tree_component.rb