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):
response_dict["pt"] = form.pt
response_dict["action"] = form.action
response_dict["update_action"] = form.update_action
response_dict["update_action_title"] = Base_translateString(form.update_action_title)
def statusLevelToString(level):
"""Transform any level format to lowercase string representation"""
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray */
(function (window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray) {
/*global window, document, rJS, RSVP, calculatePageTitle, Handlebars,
ensureArray */
(function (window, document, rJS, RSVP, calculatePageTitle, Handlebars,
ensureArray) {
"use strict";
function checkValidity() {
......@@ -173,6 +175,7 @@
erp5_form: options.erp5_form || {},
// editable: true, // ignore global editable state (be always editable)
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
extended_search: extended_search,
redirect_to_parent: options.erp5_document._embedded._view.field_your_redirect_to_parent !== undefined
......@@ -221,13 +224,25 @@
return new RSVP.Queue()
.push(function () {
// 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({
show_update_button: form_gadget.state.has_update_action
}))
.push(function (html) {
form_gadget.element.querySelector('.dialog_button_container')
.innerHTML = html;
var div = document.createElement('div'),
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 @@
}
});
}(window, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray));
}(window, document, rJS, RSVP, calculatePageTitle, Handlebars, ensureArray));
......@@ -222,7 +222,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.20956.15292.37495</string> </value>
<value> <string>976.34018.48815.32699</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -240,7 +240,7 @@
</tuple>
<state>
<tuple>
<float>1560246152.37</float>
<float>1561041762.03</float>
<string>UTC</string>
</tuple>
</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