README.md in ancestry-treeview-0.0.1 vs README.md in ancestry-treeview-0.0.2

- old
+ new

@@ -1,47 +1,43 @@ # 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.2, 1.9.3, 2.0.0; ancestry: 2.0.0 +testing ruby: 1.9.3, 2.0.0; ancestry: 2.0.0 -## About OnePuch +ancestry-treeview is an extension of `ancestry` gem to show a tree view which looks like http://jsfiddle.net/Fh47n/. -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 -## Dependencies +## Usage -jquery, and rails are required. +### Basic Usage -## Basic Usage +Add the following code in your `app/assets/stylesheets/application.css.scss` -Add the following in your app/assets/stylesheets/application.css.scss - @import "ancestry-treeview"; Then, call - model.tree + node.tree -in your view where `model` is your `ancestry` model. +in your view where `node` is your `ancestry` model. -## Custom Link +### Custom Link -As default, html links in the tree view are as +Default html links in the tree view are as - <a href="#">id</a> + <a href="#">id</a> + +You can change the html link by giving a block as -You can change the htmll links by giving a block to `#tree` method as + node.tree {|node| link_to("text", your_controller_path(node)) } - model.tree {|node| link_to("text", your_controller_path(node)) } +### Contraint Depth -## Contraint Depth +As default, all childrens of a node is shown as a tree. Use `to_depth` option to contraint the depth -As default, all childrens of specified node is shown as a tree. Use `to_depth` option to contraint the depth - - mode.tree(to_depth: 1) + 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 .