Commit d3c8d637 authored by Roque's avatar Roque

erp5_post: new post action uses dialog form

parent cebedaf6
...@@ -41,23 +41,17 @@ ...@@ -41,23 +41,17 @@
.declareMethod("render", function (parent_options, action_reference, form_definition) { .declareMethod("render", function (parent_options, action_reference, form_definition) {
var gadget = this; var gadget = this;
return gadget.createDocument(parent_options)
.push(function (jio_key) {
return gadget.jio_get(jio_key)
.push(function (new_document) {
return gadget.changeState({ return gadget.changeState({
jio_key: jio_key, doc: {title: "Untitled Document"},
doc: new_document, parent_options: parent_options,
child_gadget_url: 'gadget_erp5_pt_form_view_editable.html', child_gadget_url: 'gadget_erp5_pt_form_dialog.html',
form_type: 'page', form_type: 'dialog',
form_definition: form_definition, form_definition: form_definition,
view: action_reference, view: action_reference,
editable: true, editable: true,
has_more_views: false, has_more_views: false,
has_more_actions: true has_more_actions: true
}); });
});
});
}) })
.onStateChange(function () { .onStateChange(function () {
...@@ -79,19 +73,22 @@ ...@@ -79,19 +73,22 @@
var gadget = this, var gadget = this,
jio_key = options[0], jio_key = options[0],
//target_url = options[1], //target_url = options[1],
content_dict = options[2]; content_dict = options[2],
return gadget.notifySubmitting() document = {
.push(function () { portal_type: gadget.state.parent_options.portal_type,
return gadget.jio_get(jio_key); parent_relative_url: gadget.state.parent_options.parent_relative_url,
}) my_source_reference: gadget.state.parent_options.my_source_reference
.push(function (document) { }, property;
var property; delete content_dict.dialog_method;
for (property in content_dict) { for (property in content_dict) {
if (content_dict.hasOwnProperty(property)) { if (content_dict.hasOwnProperty(property)) {
document[property] = content_dict[property]; document['my_' + property] = content_dict[property];
} }
} }
return gadget.jio_put(jio_key, document); return this.createDocument(document)
.push(function (id) {
jio_key = id;
return gadget.notifySubmitting();
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
......
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