[IMP] web: Improve alert banner to update translations
Purpose ======= Simplify / reduce the warning message when we update a record in multi-languages Specification ============= 1/ Make the translation banner little bit lighter in design 2/ Make it still visible when coming back from breadcrumb
This commit is contained in:
committed by
Yannick Tivisse
parent
39335d4569
commit
3ad9ee7055
@@ -581,6 +581,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
|
||||
*/
|
||||
_onTranslate: function (event) {
|
||||
event.stopPropagation();
|
||||
var self = this;
|
||||
var record = this.model.get(event.data.id, {raw: true});
|
||||
this._rpc({
|
||||
route: '/web/dataset/call_button',
|
||||
@@ -589,7 +590,16 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
|
||||
method: 'translate_fields',
|
||||
args: [record.model, record.res_id, event.data.fieldName, record.getContext()],
|
||||
}
|
||||
}).then(this.do_action.bind(this));
|
||||
}).then(function (result) {
|
||||
self.do_action(result, {
|
||||
on_reverse_breadcrumb: function () {
|
||||
if (self.renderer.alertFields.length) {
|
||||
self.renderer.displayTranslationAlert();
|
||||
}
|
||||
return false
|
||||
},
|
||||
})
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -205,7 +205,8 @@ var FormController = BasicController.extend({
|
||||
}
|
||||
}
|
||||
if (alertFields.length) {
|
||||
self.renderer.displayTranslationAlert(alertFields);
|
||||
self.renderer.alertFields = alertFields;
|
||||
self.renderer.displayTranslationAlert();
|
||||
}
|
||||
}
|
||||
return changedFields;
|
||||
|
||||
@@ -82,11 +82,11 @@ var FormRenderer = BasicRenderer.extend({
|
||||
*
|
||||
* @param {Object[]} alertFields field list
|
||||
*/
|
||||
displayTranslationAlert: function (alertFields) {
|
||||
displayTranslationAlert: function () {
|
||||
this.$('.o_notification_box').remove();
|
||||
var $notification = $(qweb.render('notification-box', {type: 'info'}))
|
||||
.append(qweb.render('translation-alert', {
|
||||
fields: alertFields,
|
||||
fields: this.alertFields,
|
||||
lang: _t.database.parameters.name
|
||||
}));
|
||||
if (this.$('.o_form_statusbar').length) {
|
||||
|
||||
@@ -1249,7 +1249,7 @@
|
||||
</t>
|
||||
|
||||
<t t-name="notification-box">
|
||||
<div t-attf-class="o_notification_box alert alert-dismissible alert-{{type}}" role="alert">
|
||||
<div t-attf-class="o_notification_box mb0 alert alert-dismissible alert-{{type}}" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true" class="fa fa-times"></span>
|
||||
</button>
|
||||
@@ -1257,12 +1257,12 @@
|
||||
</t>
|
||||
|
||||
<t t-name="translation-alert">
|
||||
<t t-foreach="fields" t-as="field">
|
||||
<div>
|
||||
You have updated <strong><t t-esc="field.string"/></strong> (<t t-esc="lang"/>).
|
||||
<a class="oe_field_translate" t-att-name="field.name" href="#">Update translations</a>
|
||||
</div>
|
||||
</t>
|
||||
<div>
|
||||
Please update translations of :
|
||||
<t t-foreach="fields" t-as="field">
|
||||
<strong><a class="oe_field_translate" t-att-name="field.name" href="#"><t t-esc="field.string"/><t t-if="!field_last">, </t></a></strong>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="UserMenu">
|
||||
|
||||
Reference in New Issue
Block a user