Remove syntax error in ftl and make it more directly debugable
This commit is contained in:
@ -126,13 +126,7 @@
|
|||||||
|
|
||||||
(()=>{
|
(()=>{
|
||||||
|
|
||||||
//Removing all the undefined
|
const nonAutomaticallyConvertible = {
|
||||||
const obj = JSON.parse(JSON.stringify(<@objectToJson object=.data_model depth=0 />));
|
|
||||||
|
|
||||||
//Freemarker values that can't be automatically converted into a JavaScript object.
|
|
||||||
Object.deepAssign(
|
|
||||||
obj,
|
|
||||||
{
|
|
||||||
"messagesPerField": {
|
"messagesPerField": {
|
||||||
|
|
||||||
<#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm"]>
|
<#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm"]>
|
||||||
@ -153,7 +147,7 @@
|
|||||||
</#attempt>
|
</#attempt>
|
||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
},
|
},
|
||||||
"existsError": function (fieldName) {
|
"existsError": function (fieldName) {
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
@ -164,22 +158,20 @@
|
|||||||
</#attempt>
|
</#attempt>
|
||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
},
|
},
|
||||||
"get": function (fieldName) {
|
"get": function (fieldName) {
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#if messagesPerField.existsError('${fieldName}')>
|
<#if messagesPerField.existsError('${fieldName}')>
|
||||||
if(fieldName === "${fieldName}" ){
|
|
||||||
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
||||||
}
|
|
||||||
</#if>
|
</#if>
|
||||||
<#recover>
|
<#recover>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
},
|
},
|
||||||
"exists": function (fieldName) {
|
"exists": function (fieldName) {
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
@ -190,16 +182,27 @@
|
|||||||
</#attempt>
|
</#attempt>
|
||||||
}
|
}
|
||||||
</#list>
|
</#list>
|
||||||
throw new Error("There is no " + fieldName " field");
|
throw new Error("There is no " + fieldName + " field");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
|
"msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
|
||||||
"advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
|
"advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const out = {};
|
||||||
|
|
||||||
|
Object.deepAssign(
|
||||||
|
out,
|
||||||
|
//Removing all the undefined
|
||||||
|
JSON.parse(JSON.stringify(<@objectToJson object=.data_model depth=0 />))
|
||||||
);
|
);
|
||||||
|
|
||||||
return obj;
|
Object.deepAssign(
|
||||||
|
out,
|
||||||
|
nonAutomaticallyConvertible
|
||||||
|
);
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
})()
|
})()
|
||||||
|
|
||||||
</script>
|
</script>
|
Reference in New Issue
Block a user