Sha256: 08eff0cc33582f2ab525674de08d6d7ff521bb8a4ae509c2f430ed082ddb3aac

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

{I"
class:EFI"ProcessedAsset;FI"logical_path;FI"jstree.util.js;FI"
pathname;FI"0$root/app/assets/javascripts/jstree.util.js;FI"content_type;FI"application/javascript;FI"
mtime;Fl+9ÉSI"length;FiI"digest;F"%077fd167ede54228f0260ea3057fd3f5I"source;FI"function initTree(containerID, jsonData) {
	$("#" + containerID).jstree({
		"plugins" : [ 
			//"themes",
			"json_data","ui","crrm","cookies","dnd","search","types","hotkeys","contextmenu" 
		],
		"json_data" : { 
			"data" : prepareTreeNode(jsonData)
		}
	})
}

function prepareTreeNode(node, newParent, depth) {
	if(!depth) depth = 0;
	
	if(!newParent) {
		var root = new Object();
		root["children"] = new Array();
		root["data"] = "root";
		root["state"] = "open";
		return prepareTreeNode(node, root, depth);
	}

	var numChildren = 0;
	for(i in node) {
		numChildren ++;
		var newNode = new Object();
		newNode["metadata"] = new Object();
		newNode["metadata"]["propName"] = i;
		if (typeof node[i] == 'object'){
			newNode["data"] = i;
			newNode["children"] = new Array();
			prepareTreeNode(node[i], newNode, depth+1);
		} else {
			var value = node[i];
			value = value.length > 50 ? (value.substring(0,50) + " [...]") : value;
			newNode["data"] = i + " = " + value;
			newNode["metadata"]["propValue"] = node[i];
		}
		if(depth < 2) {
			newNode["state"] = "open";
		}
		if(newParent) {
			if(!newParent["children"]) {
				newParent["children"] = new Array();
			}
			newParent["children"].push(newNode);
		}
	}
	if(numChildren <= 0) {
		newParent["children"] = null;
	}
	return newParent;
}
;
;TI"dependency_digest;F"%c96720ea0a5063142a860c771da0a02cI"required_paths;F[I"0$root/app/assets/javascripts/jstree.util.js;FI"dependency_paths;F[{I"	path;FI"0$root/app/assets/javascripts/jstree.util.js;FI"
mtime;FI"2014-07-18T15:13:19+00:00;FI"digest;F"%371ddf5bd43c775365e615c88c7e5fb3I"
_version;F"%a56df69ef97ba4d9f1a23bf9b0add58a

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloud-toaster-1.1.6 webapp/tmp/cache/assets/development/sprockets/bfac6cd2984fbd5e0d762389e3c37164