Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default universal section title to vertical's displayName. #493

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion templates/universal-standard/script/universalresults.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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
nanhu95 marked this conversation as resolved.
Show resolved Hide resolved
(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}}