No release in over a year
ActsAsTreeDiagram extends ActsAsTree to add simple function for draw tree diagram with html.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

Acts As Tree Diagram

Acts As Tree Diagram extends ActsAsTree to add simple function for draw tree diagram with html.

Ruby Gem Version Ruby Style Guide CircleCI

See It Work

Acts As Tree Diagram

Usage

  1. (Optional) Append the following line to your app/assets/application.scss:
// If you using a sprocket
@import 'acts_as_tree_diagram'
  1. And append the line to your model file like below:
class Animal < ApplicationRecord
	extend ActsAsTreeDiagram::ViewDiagram
	acts_as_tree order: 'name'
end
  1. Then append the line to your view file like below:
<div id="act_as_tree_diagram">
    <ul class="tree">
        <li>
            <code>
                <%= link_to Animal.find(1).name, animals_path(Animal.find(1)) %>
            </code>
            <ul>
                <%= Animal.diagram_molecules_tag(where: { id: 1 }, path: animals_path).html_safe %>
            </ul>
        </li>
    </ul>
</div>

Installation

Add this line to your application's Gemfile:

gem "acts_as_tree_diagram"

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_tree_diagram

Development

Test

bin/test

Contributing

Bug reports and pull requests are welcome on Github at https://github.com/routeflags/acts_as_tree_diagram. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Changelog

Acts As Tree Diagram's changelog is available here.

Code of Conduct

Everyone interacting in the Acts As Tree Diagram project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You may enjoy owning other libraries and my company.

Аcknowledgments