Commit e0d26048 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Display update action title if configured

parent 6949fb89
...@@ -1129,6 +1129,7 @@ def renderFormDefinition(form, response_dict): ...@@ -1129,6 +1129,7 @@ def renderFormDefinition(form, response_dict):
response_dict["pt"] = form.pt response_dict["pt"] = form.pt
response_dict["action"] = form.action response_dict["action"] = form.action
response_dict["update_action"] = form.update_action response_dict["update_action"] = form.update_action
response_dict["update_action_title"] = Base_translateString(form.update_action_title)
def statusLevelToString(level): def statusLevelToString(level):
"""Transform any level format to lowercase string representation""" """Transform any level format to lowercase string representation"""
......
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray */ /*global window, document, rJS, RSVP, calculatePageTitle, Handlebars,
(function (window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray) { ensureArray */
(function (window, document, rJS, RSVP, calculatePageTitle, Handlebars,
ensureArray) {
"use strict"; "use strict";
function checkValidity() { function checkValidity() {
...@@ -173,6 +175,7 @@ ...@@ -173,6 +175,7 @@
erp5_form: options.erp5_form || {}, erp5_form: options.erp5_form || {},
// editable: true, // ignore global editable state (be always editable) // editable: true, // ignore global editable state (be always editable)
has_update_action: Boolean(options.form_definition.update_action), has_update_action: Boolean(options.form_definition.update_action),
update_action_title: options.form_definition.update_action_title,
// pass extended_search from previous view in case any gadget is curious // pass extended_search from previous view in case any gadget is curious
extended_search: extended_search, extended_search: extended_search,
redirect_to_parent: options.erp5_document._embedded._view.field_your_redirect_to_parent !== undefined redirect_to_parent: options.erp5_document._embedded._view.field_your_redirect_to_parent !== undefined
...@@ -221,13 +224,25 @@ ...@@ -221,13 +224,25 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
// Set the dialog button // Set the dialog button
if (modification_dict.hasOwnProperty('has_update_action')) { if (modification_dict.hasOwnProperty('has_update_action') ||
modification_dict.hasOwnProperty('update_action_title')) {
return form_gadget.translateHtml(dialog_button_template({ return form_gadget.translateHtml(dialog_button_template({
show_update_button: form_gadget.state.has_update_action show_update_button: form_gadget.state.has_update_action
})) }))
.push(function (html) { .push(function (html) {
form_gadget.element.querySelector('.dialog_button_container') var div = document.createElement('div'),
.innerHTML = html; dialog_button_container = form_gadget.element
.querySelector('.dialog_button_container');
div.innerHTML = html;
if (form_gadget.state.update_action_title) {
div.querySelector('button[name="action_update"]')
.textContent = form_gadget.state.form_definition
.update_action_title;
}
while (dialog_button_container.firstChild) {
dialog_button_container.firstChild.remove();
}
dialog_button_container.innerHTML = div.innerHTML;
}); });
} }
}) })
...@@ -312,4 +327,4 @@ ...@@ -312,4 +327,4 @@
} }
}); });
}(window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray)); }(window, document, 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.34018.48815.32699</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>1561041762.03</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