Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sonots/ancestry-treeview
extension of ancestry gem to show tree view
https://github.com/sonots/ancestry-treeview
Last synced: 3 months ago
JSON representation
extension of ancestry gem to show tree view
- Host: GitHub
- URL: https://github.com/sonots/ancestry-treeview
- Owner: sonots
- License: mit
- Created: 2013-06-23T13:12:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-04T13:26:03.000Z (over 11 years ago)
- Last Synced: 2024-09-17T16:51:46.222Z (4 months ago)
- Language: Ruby
- Size: 152 KB
- Stars: 8
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ancestry-treeview [![Build Status](https://secure.travis-ci.org/sonots/ancestry-treeview.png?branch=master)](http://travis-ci.org/sonots/ancestry-treeview) [![Dependency Status](https://gemnasium.com/sonots/ancestry-treeview.png)](https://gemnasium.com/sonots/ancestry-treeview)
testing ruby: 1.9.3, 2.0.0; ancestry: 2.0.0
ancestry-treeview is an extension of `ancestry` gem to show a tree view which looks like http://jsfiddle.net/Fh47n/.
## Install
gem install ancestry-treeview
## Usage
### Basic Usage
Add the following code in your `app/assets/stylesheets/application.css.scss`
@import "ancestry-treeview";
Then, call
node.tree
in your view where `node` is your `ancestry` model.
### Custom Link
Default html links in the tree view are as
id
You can change the html link by giving a block asnode.tree {|node| link_to("text", your_controller_path(node)) }
### Contraint Depth
As default, all childrens of a node is shown as a tree. Use `to_depth` option to contraint the depth
node.tree(to_depth: 1)
## Acknowledgements
I appreciate Vitaliy Bychik for giving such a nice css style at http://stackoverflow.com/questions/11167628/trees-in-twitter-bootstrap .
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new [Pull Request](../../pull/new/master)## Copyright
Copyright (c) 2013 Naotoshi SEO. See [LICENSE](LICENSE) for details.