Skip to content

Instantly share code, notes, and snippets.

@patcullen
Last active August 29, 2015 13:57
Show Gist options
  • Save patcullen/9890085 to your computer and use it in GitHub Desktop.
Save patcullen/9890085 to your computer and use it in GitHub Desktop.
A demo set of three models for Collect mobile framework
// for brevity, this sample has some properties missing :/
"client": {
"field": {
"firstname": { "type": "string", "req": true, "min": 2, "max": 50, "regex": "text", "description": "First Name" },
"lastname": { "type": "string", "req": true, "min": 2, "max": 50, "regex": "text", "description": "Last Name" },
"email": { "type": "string", "req": true, "regex": "email" },
"portfolio": { "type": "integer", "control": "input", "default": "", "req": false },
"clientproduct": { "type": "rel-many", "description": "Products this client uses", "control": "checklist" },
"clientstate": { "type": "integer", "req": false, "control": "select", "description": "State" }
},
"view": {
"default": {
"field": [{"source":"lastname"}, {"source":"firstname"}]
},
"disabled": {
"title": "R1m+",
"field": [{"source":"lastname"}, {"source":"portfolio"}],
"filter": [{"a":"portfolio", "o":">", "b":"1000000" }]
}
}
},
"clientstate": {
"field": {
"name": { "type": "string", "req": true, "min": 2, "max": 15, "regex": "text", "description": "The gender name." }
},
"insert": [{ "id": 1, "name": "Current" }, { "id": 2, "name": "Potential" }, { "id": 3, "name": "Dormant" }, { "id": 4, "name": "Cancelled" }]
},
"clientproduct": {
"field": {
"name": { "type": "string", "req": true, "min": 2, "max": 25, "regex": "text", "description": "The product name." }
},
"insert": [{ "id": 1, "name": "Capital Investment" },{ "id": 2, "name": "Stocks" },{ "id": 3, "name": "Insurance" },{ "id": 4, "name": "Hedge Fund" }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment