Class: TaoUi::Components::Tree::ItemComponent
- Inherits:
-
TaoOnRails::Components::Base
- Object
- TaoOnRails::Components::Base
- TaoUi::Components::Tree::ItemComponent
- Defined in:
- lib/tao_ui/components/tree/item_component.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#children_key ⇒ Object
readonly
Returns the value of attribute children_key.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#expandable ⇒ Object
readonly
Returns the value of attribute expandable.
-
#expanded ⇒ Object
readonly
Returns the value of attribute expanded.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
-
#selectable ⇒ Object
readonly
Returns the value of attribute selectable.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, item, options = {}) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
- #render(&block) ⇒ Object
Constructor Details
#initialize(view, item, options = {}) ⇒ ItemComponent
Returns a new instance of ItemComponent.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 9 def initialize view, item, = {} super view, @item = item @children_key = @options.delete(:children_key) @selectable = @options[:selectable] || false @depth = @options[:depth] init_remote init_children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def children @children end |
#children_key ⇒ Object (readonly)
Returns the value of attribute children_key.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def children_key @children_key end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def depth @depth end |
#expandable ⇒ Object (readonly)
Returns the value of attribute expandable.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def @expandable end |
#expanded ⇒ Object (readonly)
Returns the value of attribute expanded.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def @expanded end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def item @item end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def remote @remote end |
#selectable ⇒ Object (readonly)
Returns the value of attribute selectable.
6 7 8 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 6 def selectable @selectable end |
Class Method Details
.component_name ⇒ Object
33 34 35 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 33 def self.component_name :tree_item end |
Instance Method Details
#render(&block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tao_ui/components/tree/item_component.rb', line 21 def render &block view.content_tag tag_name, do content = view.content_tag 'div', class: 'tao-tree-item-content' do render_padding + render_icon + render_checkbox + view.capture(item, self, &block) end children = render_children &block content + children end end |