public
Last active

  • Download Gist
item.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
sc_require('models/item');
 
McAdmin.Item.FIXTURES = [
{ href: "/",
name: "Inventory",
guid: "SOMEGUID0",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
children: [
'SOMEGUID1',
'SOMEGUID2',
'SOMEGUID3'
],
parent: []},
{ href: "/Ops",
name: "Ops",
guid: "SOMEGUID1",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
parent: ['SOMEGUID0'],
children: [
'SOMEGUID2',
'SOMEGUID3'
] },
{ href: "/Ops/Net",
name: "Net",
guid: "SOMEGUID2",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
parent: ['SOMEGUID1'],
children: [] },
{ href: "/Ops/Host",
name: "Host",
guid: "SOMEGUID3",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
parent: ['SOMEGUID1'],
children: [] },
{ href: "/Sys",
name: "Sys",
guid: "SOMEGUID4",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
parent: ['SOMEGUID0'],
children: [] },
{ href: "/Client",
name: "Client",
guid: "SOMEGUID5",
mimetype: "application/x-folder",
version: 1,
properties: [],
relationships: [],
parent: ['SOMEGUID0'],
children: [] }
];
itemrecord.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
McAdmin.Item = SC.Record.extend(
/** @scope McAdmin.Item.prototype */ {
 
// TODO: Add your own code here.
href: SC.Record.attr(String),
name: SC.Record.attr(String),
guid: SC.Record.attr(String),
mimetype: SC.Record.attr(String),
version: SC.Record.attr(Number),
properties: SC.Record.attr(Array),
relationships: SC.Record.attr(Array),
primaryKey: "href",
 
 
children: SC.Record.toMany('McAdmin.Item', {inverse: "parent", isMaster: YES }),
parent: SC.Record.toOne('McAdmin.Item', {inverse: "children", isMaster: NO })
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.