Commit 1bf5b483 authored by Boris Kocherov's avatar Boris Kocherov

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

parent 1f0c33c1
......@@ -25,15 +25,14 @@
.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;
return RSVP.Queue()
.push(function () {
var portal_type = options.portal_type,
var gadget = this,
portal_type = options.portal_type,
ext = file_ext[portal_type],
ret = {
title: "Untitled Schema",
......@@ -41,14 +40,20 @@
parent_relative_url: "schema_module",
content_type: content_type[portal_type] || undefined
};
return RSVP.Queue()
.push(function () {
if (ext) {
ret.filename = "default." + ext;
}
return gadget.jio_post(ret);
})
.push(function (id) {
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-04/schema#" }']))
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