-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/jwt-support
- Loading branch information
Showing
76 changed files
with
3,038 additions
and
1,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This workflow will run our tests, generate an lcov code coverage file, | ||
# and send that coverage to Coveralls | ||
|
||
name: Code Coverage | ||
|
||
on: | ||
push: | ||
branches-ignore: dev/* | ||
pull_request: | ||
|
||
jobs: | ||
Coveralls: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [15.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npx jest tests/static/ --coverage | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{> cards/card_component componentName='document-standard' }} | ||
|
||
class document_standardCardComponent extends BaseCard['document-standard'] { | ||
constructor(config = {}, systemConfig = {}) { | ||
super(config, systemConfig); | ||
} | ||
|
||
/** | ||
* This returns an object that will be called `card` | ||
* in the template. Put all mapping logic here. | ||
* | ||
* @param profile profile of the entity in the card | ||
*/ | ||
dataForRender(profile) { | ||
let detailsData = ''; | ||
if (profile?.d_highlightedFields?.s_snippet) { | ||
const { value, matchedSubstrings } = profile.d_highlightedFields.s_snippet; | ||
detailsData = Formatter.highlightField(value, matchedSubstrings); | ||
} else if (profile.s_snippet) { | ||
detailsData = profile.s_snippet; | ||
} | ||
|
||
return { | ||
title: profile.name, // The header text of the card | ||
url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here | ||
target: '_top', // If the title's URL should open in a new tab, etc. | ||
// image: '', // The URL of the image to display on the card | ||
// altText: '', // The alternate text for the image | ||
titleEventOptions: this.addDefaultEventOptions(), | ||
subtitle: profile.externalArticleUpdateDate ? `Last Updated on ${profile.externalArticleUpdateDate}` : '', // The sub-header text of the card | ||
details: detailsData, // The text in the body of the card | ||
// The primary CTA of the card | ||
CTA1: { | ||
label: (profile.c_primaryCTA ? profile.c_primaryCTA.label : null), // The CTA's label | ||
iconName: 'chevron', // The icon to use for the CTA | ||
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking | ||
target: '_top', // Where the new URL will be opened | ||
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA | ||
eventOptions: this.addDefaultEventOptions(), | ||
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA | ||
}, | ||
// The secondary CTA of the card | ||
CTA2: { | ||
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null, | ||
iconName: 'chevron', | ||
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA), | ||
target: '_top', | ||
eventType: 'CTA_CLICK', | ||
eventOptions: this.addDefaultEventOptions(), | ||
// ariaLabel: '', | ||
} | ||
}; | ||
} | ||
|
||
/** | ||
* The template to render | ||
* @returns {string} | ||
* @override | ||
*/ | ||
static defaultTemplateName (config) { | ||
return 'cards/document-standard'; | ||
} | ||
} | ||
|
||
ANSWERS.registerTemplate( | ||
'cards/document-standard', | ||
{{{stringifyPartial (read 'cards/document-standard/template') }}} | ||
); | ||
ANSWERS.registerComponentType(document_standardCardComponent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<div class="HitchhikerDocumentStandard {{cardName}}"> | ||
{{> image }} | ||
<div class="HitchhikerDocumentStandard-body"> | ||
{{> title }} | ||
{{> subtitle }} | ||
<div class="HitchhikerDocumentStandard-contentWrapper"> | ||
<div class="HitchhikerDocumentStandard-info"> | ||
{{> details }} | ||
</div> | ||
{{> ctas }} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{{#*inline 'image'}} | ||
{{#if card.image}} | ||
<div class="HitchhikerDocumentStandard-imgWrapper"> | ||
<img class="HitchhikerDocumentStandard-img" src="{{#unless (isNonRelativeUrl card.image)}}{{@root.relativePath}}/{{/unless}}{{card.image}}" alt="{{#if card.altText}}{{card.altText}}{{/if}}"/> | ||
</div> | ||
{{/if}} | ||
{{/inline}} | ||
|
||
{{#*inline 'title'}} | ||
{{#if card.title}} | ||
<div class="HitchhikerDocumentStandard-title"> | ||
{{#if card.url}} | ||
<a class="HitchhikerDocumentStandard-titleLink js-HitchhikerDocumentStandard-titleLink" | ||
href="{{#unless (isNonRelativeUrl card.url)}}{{@root.relativePath}}/{{/unless}}{{card.url}}" | ||
data-eventtype="TITLE_CLICK" | ||
data-eventoptions='{{json card.titleEventOptions}}' | ||
target={{#if card.target}}"{{card.target}}"{{else}}"_top"{{/if}}> | ||
{{card.title}} | ||
</a> | ||
{{else}} | ||
{{card.title}} | ||
{{/if}} | ||
</div> | ||
{{/if}} | ||
{{/inline}} | ||
|
||
{{#*inline 'subtitle'}} | ||
{{#if card.subtitle}} | ||
<div class="HitchhikerDocumentStandard-subtitle"> | ||
{{card.subtitle}} | ||
</div> | ||
{{/if}} | ||
{{/inline}} | ||
|
||
{{#*inline 'details'}} | ||
{{#if card.details}} | ||
<div class="HitchhikerDocumentStandard-cardDetails"> | ||
<div class="HitchhikerDocumentStandard-detailsText js-HitchhikerCard-detailsText"> | ||
{{{card.details}}} | ||
</div> | ||
</div> | ||
{{/if}} | ||
{{/inline}} | ||
|
||
{{#*inline 'ctas'}} | ||
{{#if (any (all card.CTA1 card.CTA1.url card.CTA1.label) (all card.CTA2 card.CTA2.url card.CTA2.label))}} | ||
<div class="HitchhikerDocumentStandard-ctasWrapper"> | ||
{{> CTA card.CTA1 ctaName="primaryCTA" }} | ||
{{> CTA card.CTA2 ctaName="secondaryCTA" }} | ||
</div> | ||
{{/if}} | ||
{{/inline}} | ||
|
||
{{#*inline 'CTA'}} | ||
{{#if (all url label)}} | ||
<div class="HitchhikerDocumentStandard-{{ctaName}}"> | ||
<a class="HitchhikerCTA js-HitchhikerCTA{{#if modifiers}} {{modifiers}}{{/if}}" | ||
href="{{#unless (isNonRelativeUrl url)}}{{@root.relativePath}}/{{/unless}}{{url}}" | ||
data-eventtype="{{eventType}}" | ||
data-eventoptions='{{json eventOptions}}' | ||
target="{{#if target}}{{target}}{{else}}_top{{/if}}" | ||
{{#if ariaLabel}}aria-label="{{ariaLabel}}"{{/if}}> | ||
{{#if (any iconName iconUrl)}} | ||
<div class="HitchhikerCTA-iconWrapper"> | ||
<div class="HitchhikerCTA-icon" data-component="IconComponent" data-opts='{ | ||
"iconUrl": "{{#if iconUrl}}{{#unless (isNonRelativeUrl iconUrl)}}{{@root.relativePath}}/{{/unless}}{{iconUrl}}{{/if}}", | ||
"iconName": "{{iconName}}" | ||
}'></div> | ||
</div> | ||
{{/if}} | ||
<div class='HitchhikerCTA-iconLabel'> | ||
{{label}} | ||
</div> | ||
</a> | ||
</div> | ||
{{/if}} | ||
{{/inline}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{{> cards/card_component componentName='multilang-product-prominentvideo' }} | ||
|
||
class multilang_product_prominentvideoCardComponent extends BaseCard['multilang-product-prominentvideo'] { | ||
constructor(config = {}, systemConfig = {}) { | ||
super(config, systemConfig); | ||
} | ||
|
||
/** | ||
* This returns an object that will be called `card` | ||
* in the template. Put all mapping logic here. | ||
* | ||
* @param profile profile of the entity in the card | ||
*/ | ||
dataForRender(profile) { | ||
const youtubeUrl = Formatter.getYoutubeUrl(profile.videos); | ||
// const vimeoUrl = profile.c_vimeo; | ||
|
||
return { | ||
title: profile.name, // The header text of the card | ||
url: profile.landingPageUrl, // If the card title is a clickable link, set URL here | ||
target: '_top', // If the title's URL should open in a new tab, etc. | ||
titleEventOptions: this.addDefaultEventOptions(), | ||
subtitle: profile.featuredMessage?.description, // The sub-header text of the card | ||
videoUrl: youtubeUrl, | ||
details: profile.richTextDescription ? ANSWERS.formatRichText(profile.richTextDescription, 'richTextDescription', '_top') : null, // The text in the body of the card | ||
// If the card's details are longer than a certain character count, you can truncate the | ||
// text. A toggle will be supplied that can show or hide the truncated text. | ||
// Note: If you are using rich text for the details, you should not enable this feature. | ||
// showMoreDetails: { | ||
// showMoreLimit: 24, // Character count limit | ||
// showMoreText: {{ translateJS phrase='Show more' }}, // Label when toggle will show truncated text | ||
// showLessText: {{ translateJS phrase='Show less' }} // Label when toggle will hide truncated text | ||
// }, | ||
// The primary CTA of the card | ||
CTA1: { | ||
label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label | ||
iconName: 'chevron', // The icon to use for the CTA | ||
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking | ||
target: '_top', // Where the new URL will be opened | ||
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA | ||
eventOptions: this.addDefaultEventOptions(), | ||
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA | ||
}, | ||
// The secondary CTA of the card | ||
CTA2: { | ||
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null, | ||
iconName: 'chevron', | ||
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA), | ||
target: '_top', | ||
eventType: 'CTA_CLICK', | ||
eventOptions: this.addDefaultEventOptions(), | ||
// ariaLabel: '', | ||
} | ||
}; | ||
} | ||
|
||
/** | ||
* The template to render | ||
* @returns {string} | ||
* @override | ||
*/ | ||
static defaultTemplateName (config) { | ||
return 'cards/multilang-product-prominentvideo'; | ||
} | ||
} | ||
|
||
ANSWERS.registerTemplate( | ||
'cards/multilang-product-prominentvideo', | ||
{{{stringifyPartial (read 'cards/multilang-product-prominentvideo/template') }}} | ||
); | ||
ANSWERS.registerComponentType(multilang_product_prominentvideoCardComponent); |
Oops, something went wrong.