marley-jamaica 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
1
  RESTRICT_HIDE=1;
2
2
  RESTRICT_RO=2;
3
3
  RESTRICT_REQ=4;
4
+ TYPE_INDEX=0;
4
5
  NAME_INDEX=1;
5
- TYPE_INDEX=PROPS_INDEX=2;
6
+ PROPS_INDEX=2;
6
7
  RESTRICTIONS_INDEX=2;
7
8
  VALUE_INDEX=3;
8
9
  String.prototype.humanize=function(){return pl.map(this.replace(/^_/,'').split('_'),function(w){return w[0].toUpperCase()+w.slice(1)}).join(' ');}
@@ -25,6 +26,7 @@ pl(function(){
25
26
  });
26
27
 
27
28
  j={
29
+ copyObj:function(o){return JSON.parse(JSON.stringify(o));},
28
30
  ajax_defaults:{
29
31
  load:function(){pl('body').css('cursor','wait')},
30
32
  always:function(){pl('body').css('cursor','default');},
@@ -1,3 +1,4 @@
1
+ //need to redo this kinda.... :( :(
1
2
  r=function(target){
2
3
  this.isNodeSpec=function(){return this[0] && pl.type(this[0],'str') && this[1] && pl.type(this[1], 'obj')};
3
4
  this.nodeType=this[0];
@@ -160,7 +161,47 @@ r.nodeTypes={
160
161
  var content=i.content || [];
161
162
  content.unshift(frm);
162
163
  return ["div",{"class":"instanceContainer"},content];
163
- }
164
+ },
165
+ "ro_instance":function(i){
166
+ var content=i[2]
167
+ content.unshift(["div",{},pl.map(i.attrs.schema, function(col){
168
+ return ["div",{"class":col[1]+"ColContainer colContainer"},[["label",{},col[1].humanize()+":"],col[3]]]
169
+ })]);
170
+ return ["div",{"class":"instanceContainer"},content];
171
+ },
172
+ "instance_list":function(il) {
173
+ var name=il.attrs.name;
174
+ var schema=j.copyObj(il.attrs.schema);
175
+ if (il.attrs.recursive) {
176
+ var props={"schema":j.copyObj(schema),"recursive":true,"items":[]}
177
+ pl.each(["name","actions","group_actions"], function(i,p){{props[p]=il.attrs[p];}});
178
+ schema.push(["instance_list",props]);
179
+ };
180
+ return pl.map(il.attrs.items,function(vals){
181
+ var instance_schema=[];
182
+ var content=[];
183
+ pl.each(schema, function(i,col_spec){
184
+ var cs=j.copyObj(col_spec);
185
+ if (pl.type(col_spec[1], 'obj')) { //this is another instance_list
186
+ cs[1].items=vals[i];
187
+ content.push(cs);
188
+ } else {
189
+ cs.push(vals[i]);
190
+ instance_schema.push(cs);
191
+ }
192
+ });
193
+ return ["ro_instance",
194
+ {
195
+ "name":name,
196
+ "new_rec":false,
197
+ "url":'asdf', //FIX THIS
198
+ "schema": instance_schema,
199
+ "actions": il.attrs.actions
200
+ },
201
+ pl.map(content,function(c){return["div",{},c]})
202
+ ];
203
+ });
204
+ },
164
205
  };
165
206
  r.instanceTypes={}
166
207
  r.sectionTypes={}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marley-jamaica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2012-03-20 00:00:00 -03:00
12
+ date: 2012-04-01 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency