Class: ExpressTemplates::Components::TreeFor
- Defined in:
- lib/express_templates/components/tree_for.rb
Overview
Create an html table
or ol
(ordered list) for a model object representing a tree of similar objects.
The objects must respond to :children
.
The block is passed a NodeBuilder which may accept field names.
Example:
“‘ruby tree_for(:roles) do |role|
role.name
end “‘
If the view has an @roles variable with a Role having children, this will turn into markup such as the following:
<ul id="roles" class="roles tree">
<li>SuperAdmin
<ul>
<li>Admin</li>
<ul>
<li>Publisher</li>
<ul>
<li>Author</li>
</ul>
<li>Auditor</li>
</ol>
</li>
</ol>
</li>
</ol>
Instance Attribute Summary
Attributes inherited from Expander
Method Summary
Methods included from Capabilities::Parenting
Methods inherited from Base
Methods included from Capabilities::Iterating
Methods included from Capabilities::Wrapping
Methods included from Capabilities::Rendering
Methods included from Capabilities::Templating
Methods included from Macro
Methods inherited from Expander
#expand, #initialize, #initialize_expander, #method_missing, #process_children!, register_macros_for
Constructor Details
This class inherits a constructor from ExpressTemplates::Expander
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ExpressTemplates::Expander