Commit cb19dfe9 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Hack previous/next

parent 79d804b6
...@@ -244,15 +244,27 @@ ...@@ -244,15 +244,27 @@
selector.textContent = "\u00A0" + translated_title_list[0]; selector.textContent = "\u00A0" + translated_title_list[0];
selector.className = "ui-content-title ui-body-c ui-icon ui-icon-custom" + icon; selector.className = "ui-content-title ui-body-c ui-icon ui-icon-custom" + icon;
if (form_gadget.state.has_update_action) {
console.log(form_gadget.state.form_definition);
console.log(form_gadget.state.form_definition.update_action_title);
form_gadget.element.querySelector('button[name="action_update"]').textContent = form_gadget.state.form_definition.update_action_title;
}
// Render the erp5_from // Render the erp5_from
return form_gadget.getDeclaredGadget("erp5_form"); return form_gadget.getDeclaredGadget("erp5_form");
}) })
.push(function (erp5_form) { .push(function (erp5_form) {
var form_options = form_gadget.state.erp5_form; var form_options = form_gadget.state.erp5_form,
embedded_form,
rendered_form,
i,
len,
key;
// pass own form options to the embedded form // pass own form options to the embedded form
form_options.erp5_document = form_gadget.state.erp5_document; form_options.erp5_document = form_gadget.state.erp5_document;
form_options.form_definition = form_gadget.state.form_definition; form_options.form_definition = form_gadget.state.form_definition;
form_options.view = form_gadget.state.view; form_options.view = form_gadget.state.view;
form_options.jio_key = form_gadget.state.jio_key; form_options.jio_key = form_gadget.state.jio_key;
form_options.editable = true; // dialog is always editable form_options.editable = true; // dialog is always editable
...@@ -261,6 +273,31 @@ ...@@ -261,6 +273,31 @@
if (form_gadget.state.extended_search) { if (form_gadget.state.extended_search) {
form_options.form_definition.extended_search = form_gadget.state.extended_search; form_options.form_definition.extended_search = form_gadget.state.extended_search;
} }
console.log(form_options);
/* Remove empty non-editable fields to prevent them from displaying (business requirement).
Deleting objects inplace was not a good idea.
So we pass through only non-empty (non-editable) fields.
*/
embedded_form = form_options.erp5_document._embedded._view;
/*
for (key in embedded_form) {
if (embedded_form.hasOwnProperty(key) && key[0] !== "_") {
embedded_form[key].hidden = 1;
embedded_form[key].required = 0;
delete embedded_form[key].error_text;
}
}
*/
console.log(form_options);
/*
form_options.erp5_document = {
"_embedded": {
"_view": rendered_form
}
};
*/
return erp5_form.render(form_options); return erp5_form.render(form_options);
}) })
.push(function () { .push(function () {
...@@ -272,6 +309,7 @@ ...@@ -272,6 +309,7 @@
}) })
.push(function (all_result) { .push(function (all_result) {
form_gadget.element.querySelector('a.dialogcancel').href = all_result[0]; form_gadget.element.querySelector('a.dialogcancel').href = all_result[0];
form_gadget.enableButtonAsJob();
return form_gadget.updateHeader({ return form_gadget.updateHeader({
cancel_url: all_result[0], cancel_url: all_result[0],
page_title: all_result[1] page_title: all_result[1]
...@@ -298,7 +336,7 @@ ...@@ -298,7 +336,7 @@
} }
}, false, false) }, false, false)
.declareService(function enableButton() { .declareJob('enableButtonAsJob', function enableButton() {
// click event listener is now activated // click event listener is now activated
// Change the state of the gadget // Change the state of the gadget
var gadget = this, var gadget = this,
...@@ -311,5 +349,10 @@ ...@@ -311,5 +349,10 @@
update_button.disabled = false; update_button.disabled = false;
} }
}); });
/*
.declareService(function () {
return this.enableButtonAsJob();
});
*/
}(window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray)); }(window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray));
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>976.20956.15292.37495</string> </value> <value> <string>976.22331.21487.3942</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1560246152.37</float> <float>1560328214.66</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