Commit 213b8219 authored by Roque's avatar Roque

erp5_post: post action forms moved to erp5_post

parent b20eb74a
......@@ -14,6 +14,5 @@
</head>
<body>
NEW HTML Post Action GADGET FIELD HTML!
</body>
</html>
\ No newline at end of file
......@@ -22,13 +22,7 @@
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
console.log("GADGET FIELD RENDER METHOD!!!");
return;
})
.declareMethod("handleRender", function (gadget, gadget_utils, options, action_reference, parent_portal_type, form_definition) {
console.log("GADGET FIELD handleRender METHOD!!!");
var child_gadget_url = 'gadget_erp5_pt_form_view_editable.html';
return RSVP.Queue()
.push(function () {
......@@ -67,7 +61,6 @@
})
.declareMethod("handleSubmit", function (gadget, gadget_utils, jio_key, content_dict) {
console.log("GADGET FIELD handleSubmit METHOD!!!");
return gadget.notifySubmitting()
.push(function () {
return gadget.jio_get(jio_key);
......@@ -95,8 +88,4 @@
});
});
/*.onStateChange(function () {
return gadget_utils.renderGadget(this);
});*/
}(window, rJS, RSVP));
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Reply Action</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_field_reply_action_js_script.js"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_field_reply_action_js_script.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
var gadget_utils;
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod('getUrlParameter', 'getUrlParameter')
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("handleRender", function (gadget, gadget_utils, options, action_reference, parent_portal_type, form_definition) {
var child_gadget_url = 'gadget_erp5_pt_form_view_editable.html';
return gadget.jio_get(options.jio_key)
.push(function (parent_document) {
var title = parent_document.title;
if (!title.startsWith('Re: ')) { title = 'Re: ' + parent_document.title; }
return gadget.changeState({
doc: {title: title},
parent_document: parent_document,
child_gadget_url: child_gadget_url,
form_definition: form_definition,
view: action_reference,
editable: true,
has_more_views: false,
has_more_actions: false,
is_form_list: false
});
});
})
.declareMethod("handleSubmit", function (gadget, gadget_utils, jio_key, content_dict) {
var document = {
my_title: gadget.state.doc.title,
portal_type: gadget.state.parent_document.portal_type,
parent_relative_url: gadget.state.parent_document.parent_relative_url,
my_source_reference: gadget.state.parent_document.source_reference
}, property;
for (property in content_dict) {
if (content_dict.hasOwnProperty(property)) {
document['my_' + property] = content_dict[property];
}
}
return gadget_utils.createDocument(document)
.push(function (id) {
jio_key = id;
return gadget.notifySubmitting();
})
.push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {
jio_key: jio_key,
editable: true
}
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_field_reply_action_js_script.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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