Acts As Tree Diagram
Acts As Tree Diagram extends ActsAsTree to add simple function for draw tree diagram with html.
See It Work
Usage
- (Optional) Append the following line to your
app/assets/application.scss
:
// If you using a sprocket
@import 'acts_as_tree_diagram'
- And append the line to your model file like below:
class Animal < ApplicationRecord
extend ActsAsTreeDiagram::ViewDiagram
acts_as_tree order: 'name'
end
- 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.
-
routeflagsinc / jma — Bitbucket
- for the Japan Meteorological Agency (気象庁) for searching new information simplifies.
-
smapira / punch_time — Bitbucket
- Work time calculations using punch clock.
-
smapira / rspec-css — Bitbucket
- Record your test suite's computed CSS during future test runs for deterministic and accurate tests.
- routeflags/timeline_rails_helper: The TimelineRailsHelper provides a timeline_molecules_tag helper to draw a vertical time line usable with vanilla CSS.
- 株式会社旗指物