Ajax Tree Plugin

Posted by anup.narkhede on December 19, 2007

Introduction

This is a helper plugin to generate ajax based tree structure (two level). It can be used for two models having n:m or 1:n relationships. A leaf from any branch can be dragged and dropped in another branch. A scaffolding arrangement is also done to create a new branch, add leaf etc.

Sceenshot

For example:

Installation:

Here we take the previous example of Category and Article models. Generate the ajax controller for the two models.

Usage

Example

Copy static files

Copy add.png, delete.png from /vendor/plugins/ajax_tree/ directory to /public/images directory.

Copy ajax_tree.css file from /vendor/plugins/ajax_tree/ directory to /public/stylesheets/ directory.
Include css in your application layout

Call the helpers

Specify model names for branch model and leaf model in /views/home/_show_ajax_tree.rhtml partial.

Then, call this partial in any rhtml, where you want to display the ajax tree. In this case, we have done it in /views/home/index.rhtml

home_controller.rb (Generated automatically)

index.rhtml

Contributions:

This project is hosted at http://code.google.com/p/ajax-tree/. Please leave your feedback.