#192: fix bad logic in ftl to js script
This commit is contained in:
parent
0b1ff529f7
commit
ab906ec417
@ -32,7 +32,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
"printIfExists": function (fieldName, x) {
|
"printIfExists": function (fieldName, x) {
|
||||||
<#if !messagesPerField?? >
|
<#if !messagesPerField?? >
|
||||||
return undefined;
|
return undefined;
|
||||||
</#if>
|
<#else>
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
<#attempt>
|
<#attempt>
|
||||||
@ -42,11 +42,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName + " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
|
</#if>
|
||||||
},
|
},
|
||||||
"existsError": function (fieldName) {
|
"existsError": function (fieldName) {
|
||||||
<#if !messagesPerField?? >
|
<#if !messagesPerField?? >
|
||||||
return false;
|
return false;
|
||||||
</#if>
|
<#else>
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
<#attempt>
|
<#attempt>
|
||||||
@ -56,11 +57,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName + " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
|
</#if>
|
||||||
},
|
},
|
||||||
"get": function (fieldName) {
|
"get": function (fieldName) {
|
||||||
<#if !messagesPerField?? >
|
<#if !messagesPerField?? >
|
||||||
return '';
|
return '';
|
||||||
</#if>
|
<#else>
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
<#attempt>
|
<#attempt>
|
||||||
@ -72,11 +74,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName + " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
|
</#if>
|
||||||
},
|
},
|
||||||
"exists": function (fieldName) {
|
"exists": function (fieldName) {
|
||||||
<#if !messagesPerField?? >
|
<#if !messagesPerField?? >
|
||||||
return false;
|
return false;
|
||||||
</#if>
|
<#else>
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
<#attempt>
|
<#attempt>
|
||||||
@ -86,6 +89,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName + " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
|
</#if>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user