Commit 0a9563e2 authored by Roque's avatar Roque

erp5_officejs: code cleanup

parent affec7de
...@@ -78,13 +78,13 @@ ...@@ -78,13 +78,13 @@
scope: "action_field", scope: "action_field",
element: fragment element: fragment
}) })
.push(function (action_gadget) { .push(function (action_gadget) {
return action_gadget.preRenderDocument(options); return action_gadget.preRenderDocument(options);
}) })
.push(function (doc) { .push(function (doc) {
state_options.doc = doc; state_options.doc = doc;
return gadget.changeState(state_options); return gadget.changeState(state_options);
}); });
} else { } else {
return gadget.changeState(state_options); return gadget.changeState(state_options);
} }
...@@ -93,17 +93,16 @@ ...@@ -93,17 +93,16 @@
.onStateChange(function () { .onStateChange(function () {
var fragment = document.createElement('div'), var fragment = document.createElement('div'),
gadget = this, gadget = this;
options;
while (this.element.firstChild) { while (this.element.firstChild) {
this.element.removeChild(this.element.firstChild); this.element.removeChild(this.element.firstChild);
} }
this.element.appendChild(fragment); this.element.appendChild(fragment);
return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment, return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment,
scope: 'fg'}) scope: 'fg'})
.push(function (form_view_gadget) { .push(function (form_view_gadget) {
return form_view_gadget.render(gadget.state); return form_view_gadget.render(gadget.state);
}); });
}) })
.declareMethod('triggerSubmit', function () { .declareMethod('triggerSubmit', function () {
...@@ -118,7 +117,8 @@ ...@@ -118,7 +117,8 @@
//target_url = options[1], //target_url = options[1],
content_dict = options[2], content_dict = options[2],
fragment = document.createElement('div'), fragment = document.createElement('div'),
action_gadget_url, jio_key; action_gadget_url,
jio_key;
if (gadget.state.valid_action) { if (gadget.state.valid_action) {
action_gadget_url = gadget.state.form_definition.fields_raw_properties.gadget_field_action_js_script.values.gadget_url; action_gadget_url = gadget.state.form_definition.fields_raw_properties.gadget_field_action_js_script.values.gadget_url;
gadget.element.appendChild(fragment); gadget.element.appendChild(fragment);
...@@ -126,30 +126,27 @@ ...@@ -126,30 +126,27 @@
scope: "action_field", scope: "action_field",
element: fragment element: fragment
}) })
.push(function (action_gadget) { .push(function (action_gadget) {
return action_gadget.handleSubmit(content_dict, gadget.state); return action_gadget.handleSubmit(content_dict, gadget.state);
}) })
.push(function (id) { .push(function (id) {
jio_key = id; jio_key = id;
return gadget.notifySubmitting(); return gadget.notifySubmitting();
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
}) })
.push(function () { .push(function () {
return gadget.redirect({ return gadget.redirect({
command: 'display', command: 'display',
options: { options: {
jio_key: jio_key, jio_key: jio_key,
editable: true editable: true
} }
});
}); });
});
} else { } else {
return gadget.notifySubmitted({message: 'Could not perform this action: configuration error', status: 'fail'}) return gadget.notifySubmitted({message: 'Could not perform this action: configuration error', status: 'fail'});
.push(function () {
return;
});
} }
}); });
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.40721.35496.30668</string> </value> <value> <string>975.61078.33779.341</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1557500271.45</float> <float>1558720717.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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