You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
271 lines
6.9 KiB
271 lines
6.9 KiB
4 years ago
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>Edit Recipe • YOPA</title>
|
||
|
<script src="bundle.js"></script>
|
||
|
<link rel="stylesheet" href="style.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="content">
|
||
|
<div id="edit-object-form"></div>
|
||
|
|
||
|
<script>
|
||
|
onLoad(() => {
|
||
|
window.app = Yopa.editObjectForm({
|
||
|
"model_id": 0,
|
||
|
// this is objects that can be chosen as related
|
||
|
"objects": [
|
||
|
{
|
||
|
"id": 11,
|
||
|
"model": 2,
|
||
|
"name": "Lemon"
|
||
|
},
|
||
|
{
|
||
|
"id": 12,
|
||
|
"model": 2,
|
||
|
"name": "Custard"
|
||
|
}
|
||
|
],
|
||
|
// schema, possibly restricted to the relevant entries
|
||
|
"schema": {
|
||
|
"obj_models": [
|
||
|
{
|
||
|
"id": 2,
|
||
|
"name": "Ingredient"
|
||
|
},
|
||
|
{
|
||
|
"id": 0,
|
||
|
"name": "Recipe"
|
||
|
},
|
||
|
{
|
||
|
"id": 1,
|
||
|
"name": "Book"
|
||
|
}
|
||
|
],
|
||
|
"prop_models": [
|
||
|
{
|
||
|
"data_type": "Integer",
|
||
|
"default": {
|
||
|
"Integer": 0
|
||
|
},
|
||
|
"id": 13,
|
||
|
"multiple": false,
|
||
|
"name": "Number",
|
||
|
"object": 0,
|
||
|
"optional": true
|
||
|
},
|
||
|
{
|
||
|
"data_type": "String",
|
||
|
"default": {
|
||
|
"String": ""
|
||
|
},
|
||
|
"id": 17,
|
||
|
"multiple": true,
|
||
|
"name": "MultiString",
|
||
|
"object": 0,
|
||
|
"optional": false
|
||
|
},
|
||
|
{
|
||
|
"data_type": "Integer",
|
||
|
"default": {
|
||
|
"Integer": 0
|
||
|
},
|
||
|
"id": 7,
|
||
|
"multiple": false,
|
||
|
"name": "page",
|
||
|
"object": 6,
|
||
|
"optional": true
|
||
|
},
|
||
|
{
|
||
|
"data_type": "String",
|
||
|
"default": {
|
||
|
"String": ""
|
||
|
},
|
||
|
"id": 18,
|
||
|
"multiple": true,
|
||
|
"name": "OptiMultiString",
|
||
|
"object": 0,
|
||
|
"optional": true
|
||
|
},
|
||
|
{
|
||
|
"data_type": "Boolean",
|
||
|
"default": {
|
||
|
"Boolean": false
|
||
|
},
|
||
|
"id": 14,
|
||
|
"multiple": false,
|
||
|
"name": "Bool",
|
||
|
"object": 0,
|
||
|
"optional": false
|
||
|
},
|
||
|
{
|
||
|
"data_type": "String",
|
||
|
"default": {
|
||
|
"String": ""
|
||
|
},
|
||
|
"id": 15,
|
||
|
"multiple": false,
|
||
|
"name": "String",
|
||
|
"object": 0,
|
||
|
"optional": false
|
||
|
},
|
||
|
{
|
||
|
"data_type": "Decimal",
|
||
|
"default": {
|
||
|
"Decimal": 0.0
|
||
|
},
|
||
|
"id": 16,
|
||
|
"multiple": false,
|
||
|
"name": "Float",
|
||
|
"object": 0,
|
||
|
"optional": false
|
||
|
},
|
||
|
{
|
||
|
"data_type": "String",
|
||
|
"default": {
|
||
|
"String": ""
|
||
|
},
|
||
|
"id": 10,
|
||
|
"multiple": false,
|
||
|
"name": "qty",
|
||
|
"object": 9,
|
||
|
"optional": true
|
||
|
}
|
||
|
],
|
||
|
"rel_models": [
|
||
|
{
|
||
|
"id": 6,
|
||
|
"multiple": true,
|
||
|
"name": "book reference",
|
||
|
"object": 0,
|
||
|
"optional": true,
|
||
|
"reciprocal_name": "recipes",
|
||
|
"related": 1
|
||
|
},
|
||
|
{
|
||
|
"id": 8,
|
||
|
"multiple": true,
|
||
|
"name": "related recipe",
|
||
|
"object": 0,
|
||
|
"optional": true,
|
||
|
"reciprocal_name": "related recipe",
|
||
|
"related": 0
|
||
|
},
|
||
|
{
|
||
|
"id": 9,
|
||
|
"multiple": true,
|
||
|
"name": "ingredient",
|
||
|
"object": 0,
|
||
|
"optional": true,
|
||
|
"reciprocal_name": "recipes",
|
||
|
"related": 2
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
"object": {
|
||
|
"id": 19,
|
||
|
"model": 0,
|
||
|
"name": "Custard with lemon",
|
||
|
"values": {
|
||
|
"14": [{
|
||
|
"id": 25,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"Boolean": true
|
||
|
}
|
||
|
}],
|
||
|
"17": [{
|
||
|
"id": 21,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"String": "Bla"
|
||
|
}
|
||
|
}, {
|
||
|
"id": 22,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"String": "Ble"
|
||
|
}
|
||
|
}, {
|
||
|
"id": 23,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"String": "Bli"
|
||
|
}
|
||
|
}],
|
||
|
"15": [{
|
||
|
"id": 26,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"String": "Bla"
|
||
|
}
|
||
|
}],
|
||
|
"16": [{
|
||
|
"id": 27,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"Decimal": 15.6
|
||
|
}
|
||
|
}],
|
||
|
"13": [{
|
||
|
"id": 20,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"Integer": 15
|
||
|
}
|
||
|
}],
|
||
|
"18": [{
|
||
|
"id": 24,
|
||
|
"object": 19,
|
||
|
"value": {
|
||
|
"String": "sdfsfsdfsdf"
|
||
|
}
|
||
|
}]
|
||
|
},
|
||
|
"relations": {
|
||
|
"6": [],
|
||
|
"8": [],
|
||
|
"9": [
|
||
|
{
|
||
|
"id": 28,
|
||
|
"object": 19,
|
||
|
"model": 9,
|
||
|
"related": 11,
|
||
|
"values": {
|
||
|
"10": [{
|
||
|
"id": 29,
|
||
|
"object": 28,
|
||
|
// model:10
|
||
|
"value": {
|
||
|
"String": "1"
|
||
|
}
|
||
|
}],
|
||
|
}
|
||
|
}, {
|
||
|
"id": 30,
|
||
|
"object": 19,
|
||
|
"model": 9,
|
||
|
"related": 12,
|
||
|
"values": {
|
||
|
"10": [{
|
||
|
"id": 31,
|
||
|
"object": 30,
|
||
|
// model:10
|
||
|
"value": {
|
||
|
"String": "2"
|
||
|
}
|
||
|
}],
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
},
|
||
|
}
|
||
|
})
|
||
|
});
|
||
|
</script>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|