Commit b0df924d authored by Caleb Weeks's avatar Caleb Weeks

prefixing hbsValidName with './' to avoid helper and field name collisions

parent 6f938d50
......@@ -201,7 +201,10 @@ function loadComponent(rtype, roots, widgetRegistry, hb){
if(fdsc){widget.fieldDescription=fdsc;}
if(!widget.name){throw new Error("Widget without name:\n" + JSON.stringify(widget,null," "))}
widget.key=widget.name.replace(/^.\/\.\/|^\.\//g, "").replace(/\/\.\//g,"/");
widget.hbsValidName = _.map(widget.name.split('/'), (nameSegment)=>{
//prefixing with './' avoids fieldname and helper function name collisions
// eq: we have a helper named 'quote' which is not uncommon for a field name
widget.hbsValidName = "./" + _.map(widget.name.split('/'), (nameSegment)=>{
return /[^\w^:]/.test(nameSegment) ? '['+nameSegment +']' : nameSegment;
}).join('/');
widget.lockAllowed = widget.widget !== 'hidden' && !widget.readonly && !widget.diabled;
......
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