Commit 4b041c02 authored by Valentin Benozillo's avatar Valentin Benozillo Committed by Valentin Benozillo

erp5_web_renderjs_ui: Add missed invalid message translation

parent 5e4454e0
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Input is required but no input given.
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>MultiListfield</title>
......
......@@ -28,6 +28,7 @@
}
rJS(window)
.declareAcquiredMethod("translate", "translate")
.declareMethod('render', function (options) {
var field_json = options.field_json || {},
item_list = ensureArray(field_json.items).map(function (item) {
......@@ -171,9 +172,16 @@
var gadget = this,
empty = true;
if (this.state.editable && this.state.required) {
return this.getContent()
.push(function (result) {
var value_list = result[gadget.state.sub_select_key],
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getContent(),
gadget.translate("Input is required but no input given.")
]);
})
.push(function (all_result) {
var value_list = all_result[0][gadget.state.sub_select_key],
error_message = all_result[1],
i;
for (i = 0; i < value_list.length; i += 1) {
if (value_list[i]) {
......@@ -181,7 +189,7 @@
}
}
if (empty) {
return gadget.notifyInvalid("Please fill out this field.");
return gadget.notifyInvalid(error_message);
}
return gadget.notifyValid();
})
......
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Input is required but no input given.
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Radiofield</title>
......
......@@ -31,6 +31,7 @@
rJS(window)
.declareAcquiredMethod("notifyValid", "notifyValid")
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")
.declareAcquiredMethod("translate", "translate")
.declareMethod('render', function (options) {
var field_json = options.field_json || {},
state_dict = {
......@@ -156,11 +157,19 @@
gadget = this,
empty;
if (this.state.editable && this.state.required) {
return this.getContent()
.push(function (result) {
empty = !result[name];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getContent(),
gadget.translate("Input is required but no input given.")
]);
})
.push(function (all_result) {
var content = all_result[0],
error_message = all_result[1];
empty = !content[name];
if (empty) {
return gadget.notifyInvalid("Please fill out this field.");
return gadget.notifyInvalid(error_message);
}
return gadget.notifyValid();
})
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>valentin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.30669.46484.853</string> </value>
<value> <string>976.61321.38056.58231</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1556896193.1</float>
<float>1562581079.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,6 +5,7 @@
data-i18n=No such document was found
data-i18n=Create New
data-i18n=Explore the Search Result List
data-i18n=No such document was found
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
......
......@@ -131,6 +131,7 @@
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getFormContent", "getFormContent")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("translate", "translate")
// .declareAcquiredMethod("addRelationInput", "addRelationInput")
/////////////////////////////////////////////////////////////////
......@@ -494,12 +495,17 @@
}, true, false)
.declareMethod('checkValidity', function () {
var gadget = this;
if ((this.state.value_text) && (
(this.state.value_relative_url === null) &&
(this.state.value_uid === null) &&
(this.state.value_portal_type === null)
)) {
return this.notifyInvalid("No such document was found")
return gadget.translate("No such document was found")
.push(function (error_message) {
return gadget.notifyInvalid(error_message);
})
.push(function () {
return false;
});
......
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Invalid DateTime
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>HTML5 Input</title>
......
......@@ -17,7 +17,7 @@
}
rJS(window)
.declareAcquiredMethod("translate", "translate")
.declareMethod('render', function render(options) {
return this.changeState({
value: getFirstNonEmpty(options.value, ""),
......@@ -192,7 +192,10 @@
if (value) {
date = Date.parse(value);
if (isNaN(date)) {
return gadget.notifyInvalid("Invalid DateTime")
return gadget.translate("Invalid DateTime")
.push(function (error_message) {
return gadget.notifyInvalid(error_message);
})
.push(function () {
return false;
});
......
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