Sha256: a709c316ac2ca7608a881f0d4a5569bc146f2e186866662dfaa9b42037f7a292

Contents?: true

Size: 960 Bytes

Versions: 5

Compression:

Stored size: 960 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[:selectable] || false
        @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

5 entries across 5 versions & 1 rubygems

Version Path
tao_ui-0.3.4 lib/tao_ui/components/tree_component.rb
tao_ui-0.3.3 lib/tao_ui/components/tree_component.rb
tao_ui-0.3.2 lib/tao_ui/components/tree_component.rb
tao_ui-0.3.1 lib/tao_ui/components/tree_component.rb
tao_ui-0.3.0 lib/tao_ui/components/tree_component.rb