This commit is contained in:
kgiszewski
2015-06-15 14:48:50 -04:00
parent 34b4209de7
commit c60c9e1c5d
+16 -5
View File
@@ -152,14 +152,24 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
if (template.length < 1)
return fieldsetConfig.label;
var rgx = /{{([^)].*)}}/g;
var rgx = /({{(.*?)}})*/g;
var results;
var parsedTemplate = template;
while ((results = rgx.exec(template)) !== null) {
var rawMatches = template.match(rgx);
var matches = [];
_.each(rawMatches, function(match){
if(match) {
matches.push(match);
}
});
_.each(matches, function (match) {
// split the template in case it consists of multiple property aliases and/or functions
var templates = results[0].replace("{{", '').replace("}}", '').split("|");
var templates = match.replace("{{", '').replace("}}", '').split("|");
var templateLabelValue = "";
for(var i = 0; i < templates.length; i++) {
@@ -229,8 +239,9 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
}
}
parsedTemplate = parsedTemplate.replace(results[0], templateLabelValue);
}
parsedTemplate = parsedTemplate.replace(match, templateLabelValue);
});
return parsedTemplate;
}