diff --git a/templates/universal-standard/script/universalresults.hbs b/templates/universal-standard/script/universalresults.hbs index 194b7eb21..c1b1f66aa 100644 --- a/templates/universal-standard/script/universalresults.hbs +++ b/templates/universal-standard/script/universalresults.hbs @@ -66,7 +66,7 @@ ANSWERS.addComponent("UniversalResults", Object.assign({}, { cardType: "{{{cardType}}}" }, {{/if}} - sectionTitle: {{#if sectionTitle}}"{{{sectionTitle}}}"{{else}}{{#if label}}"{{{label}}}"{{else}}"{{{verticalKey}}}"{{/if}}{{/if}}, + sectionTitle: {{#if sectionTitle}}"{{{sectionTitle}}}"{{else}}"{{> verticalLabel overridedLabel=label verticalKey=verticalKey fallback=verticalKey}}"{{/if}}, {{#if icon}} sectionTitleIconName: "{{{icon}}}", {{/if}} @@ -98,3 +98,40 @@ ANSWERS.addComponent("UniversalResults", Object.assign({}, { }, {{/if}} {{/inline}} + +{{!-- + Prints the vertical label according to specific logic + Assumes @root has environment variables and global_config + @param overridedLabel The hardcoded label from configuration in repo, meant to supercede defaults + @param verticalKey The current vertical key, if it exists + @param fallback The fallback for the label if all else doesn't exist +--}} +{{#*inline 'verticalLabel'}} + {{~#if overridedLabel ~}} + {{{overridedLabel}}} + {{~ else if + (lookup + (lookup + (lookup + (lookup + @root.env.JAMBO_INJECTED_DATA.answers.experiences + @root.global_config.experienceKey) + 'verticals') + verticalKey) + 'displayName') + ~}} + {{{lookup + (lookup + (lookup + (lookup + @root.env.JAMBO_INJECTED_DATA.answers.experiences + @root.global_config.experienceKey) + 'verticals') + verticalKey) + 'displayName'}}} + {{~ else if verticalKey ~}} + {{{verticalKey}}} + {{~ else ~}} + {{{fallback}}} + {{~/if ~}} +{{/inline}}