Skip to content

Commit

Permalink
restructure instance_list, need to modify instance to match
Browse files Browse the repository at this point in the history
  • Loading branch information
herbdaily committed Mar 29, 2012
1 parent bd3d8e6 commit 4246901
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions lib/marley/client/jamaica.js
Expand Up @@ -26,6 +26,7 @@ pl(function(){
}); });


j={ j={
copyObj:function(o){return JSON.parse(JSON.stringify(o));},
ajax_defaults:{ ajax_defaults:{
load:function(){pl('body').css('cursor','wait')}, load:function(){pl('body').css('cursor','wait')},
always:function(){pl('body').css('cursor','default');}, always:function(){pl('body').css('cursor','default');},
Expand Down
42 changes: 26 additions & 16 deletions lib/marley/client/reggae.js
Expand Up @@ -164,24 +164,34 @@ r.nodeTypes={
"populate_schema":function(schema, vals){ "populate_schema":function(schema, vals){
}, },
"instance_list":function(il) { "instance_list":function(il) {
var schema=il.attrs.schema;
var name=il.attrs.name; var name=il.attrs.name;
var content_schema=[]; var schema=j.copyObj(il.attrs.schema);
while(schema[schema.length-1][0]=='resource'){ if (il.attrs.recursive) { schema.push(il.attrs.schema);};
content_schema << schema.pop();
}
return pl.map(il.attrs.items,function(vals){ return pl.map(il.attrs.items,function(vals){
var i=0; var instance_schema=[];
return r.call(["instance",{ var content=[];
"name":name, pl.each(schema, function(i,col_spec){
"new_rec":false, if (pl.type(col_spec[0], 'arr')) { //this is another schema
"url":'asdf', //FIX THIS content.push(
"schema": pl.map(schema, function(col){ ["instance_list",{
col[VALUE_INDEX]=vals[i]; "schema":col_spec,
i++; "items":vals[i],
return col; "name":name
}), }]
}]); );
} else {
instance_schema.push(col_spec.push(vals[i]));
}
});
return ["instance",
{
"name":name,
"new_rec":false,
"url":'asdf', //FIX THIS
"schema": instance_schema,
},
content
];
}); });
}, },
}; };
Expand Down

0 comments on commit 4246901

Please sign in to comment.