Sha256: 93d87d20e48e28943957cdeed5369a029bb6d04c152ce71a7417e43e00a42ba0

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module ExpressTemplates
  module Components
    #
    # Create an html <tt>table</tt> or <tt>ol</tt> (ordered list) for
    # a model object representing a tree of similar objects.
    #
    # The objects must respond to <tt>:children</tt>.
    #
    # 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>
    #
    class TreeFor < Container
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
express_templates-0.3.1 lib/express_templates/components/tree_for.rb
express_templates-0.3.0 lib/express_templates/components/tree_for.rb