Update jOrgChart and README

master
Guillaume DOTT 2013-02-04 17:26:51 +01:00
parent 4ef470fe9b
commit 57534dcbbb
2 changed files with 22 additions and 6 deletions

View File

@ -1,6 +1,11 @@
# Jorgchart::Rails
TODO: Write a gem description
jOrgChart for Rails. Bundled up jOrgChart into something useable with the Rails 3.1 asset pipeline
This gem include my forked version of jOrgChart (https://github.com/gdott9/jOrgChart/tree/my-master) which adds some features waiting to be merged.
Additionnal features :
* render list with multiple nodes on the first level (https://github.com/wesnolte/jOrgChart/pull/34)
* add an option to ignore space used by collapsed nodes (https://github.com/wesnolte/jOrgChart/pull/35)
## Installation
@ -18,7 +23,15 @@ Or install it yourself as:
## Usage
TODO: Write usage instructions here
In application.js
```
//= require jquery.jorgchart
```
This gem comes with a stylesheet for default style. To use it, add the following line in application.css
```
//= require jquery.jorgchart
```
## Contributing

View File

@ -99,7 +99,8 @@
chartElement : 'body',
depth : -1,
chartClass : "jOrgChart",
dragAndDrop: false
dragAndDrop: false,
ignoreSpace: false
};
function buildNodes($list, $appendTo, opts) {
@ -160,7 +161,7 @@
if($tr.hasClass('contracted')){
$this.css('cursor','n-resize');
$tr.removeClass('contracted').addClass('expanded');
$tr.nextAll("tr").css('visibility', '');
$tr.nextAll("tr").css(opts.ignoreSpace ? 'display' : 'visibility', '');
// Update the <li> appropriately so that if the tree redraws collapsed/non-collapsed nodes
// maintain their appearance
@ -168,7 +169,8 @@
}else{
$this.css('cursor','s-resize');
$tr.removeClass('expanded').addClass('contracted');
$tr.nextAll("tr").css('visibility', 'hidden');
if(opts.ignoreSpace) { $tr.nextAll("tr").css('display', 'none'); }
else { $tr.nextAll("tr").css('visibility', 'hidden'); }
$node.addClass('collapsed');
}
@ -230,7 +232,8 @@
$.each(classList, function(index,item) {
if (item == 'collapsed') {
console.log($node);
$nodeRow.nextAll('tr').css('visibility', 'hidden');
if(opts.ignoreSpace) { $nodeRow.nextAll('tr').css('display', 'none'); }
else { $nodeRow.nextAll('tr').css('visibility', 'hidden'); }
$nodeRow.removeClass('expanded');
$nodeRow.addClass('contracted');
$nodeDiv.css('cursor','s-resize');