Commit 9ca96410 authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs: schema_editor: use id as reference in new created document

parent 14db1f18
......@@ -25,30 +25,35 @@
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_put", "jio_put")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this;
var gadget = this,
portal_type = options.portal_type,
ext = file_ext[portal_type],
ret = {
title: "Untitled Schema",
portal_type: "JSON Schema",
parent_relative_url: "schema_module",
content_type: content_type[portal_type] || undefined
};
return RSVP.Queue()
.push(function () {
var portal_type = options.portal_type,
ext = file_ext[portal_type],
ret = {
title: "Untitled Schema",
portal_type: "JSON Schema",
parent_relative_url: "schema_module",
content_type: content_type[portal_type] || undefined
};
if (ext) {
ret.filename = "default." + ext;
}
return gadget.jio_post(ret);
})
.push(function (id) {
return gadget.jio_putAttachment(id, 'data',
new Blob(['{"$schema": "http://json-schema.org/draft-04/schema#" }']))
ret.reference = id;
return gadget.jio_put(id, ret)
.push(function () {
return gadget.jio_putAttachment(id, 'data',
new Blob(['{"$schema": "http://json-schema.org/draft-07/schema#" }']));
})
.push(function () {
return gadget.updatePanel({editable: true});
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment