--- a/client/js/full-json.js Tue Aug 21 12:46:11 2012 +0200
+++ b/client/js/full-json.js Tue Aug 21 16:27:26 2012 +0200
@@ -7,48 +7,12 @@
}
var _load = function() {
Rkns.$.getJSON(_opts.url, function(_data) {
- _proj.get("users").add(_data.users);
- Rkns._(_data.nodes).each(function(_item) {
- _proj.addNode(_item);
- });
- Rkns._(_data.edges).each(function(_item) {
- _proj.addEdge(_item);
- });
+ console.log("Setting data");
+ _proj.set(_data);
});
}
var _save = function() {
- var _data = {
- users: _proj.get("users").map(function(_item) {
- return {
- id: _item.get("id"),
- title: _item.get("title"),
- uri: _item.get("uri"),
- description: _item.get("description"),
- color: _item.get("color")
- }
- }),
- nodes: _proj.get("nodes").map(function(_item) {
- return {
- id: _item.get("id"),
- title: _item.get("title"),
- uri: _item.get("uri"),
- description: _item.get("description"),
- position: _item.get("position"),
- created_by: _item.get("created_by").get("id")
- }
- }),
- edges: _proj.get("edges").map(function(_item) {
- return {
- id: _item.get("id"),
- title: _item.get("title"),
- uri: _item.get("uri"),
- description: _item.get("description"),
- from: _item.get("from").get("id"),
- to: _item.get("to").get("id"),
- created_by: _item.get("created_by").get("id")
- }
- })
- };
+ var _data = _proj.toJSON();
Rkns.$.ajax({
type: _opts.http_method,
url: _opts.url,