Skip to content

Commit

Permalink
Version 1.33.0 (#1146)
Browse files Browse the repository at this point in the history
## v1.33.0

### Changes

- Update FAQ card to support answerV2 instead of answer (#1142)
- Update corresponding translation tests for above changes (#1147)
  • Loading branch information
likimmy authored Aug 14, 2023
2 parents 7c3bb22 + f84e49e commit 0222c71
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
11 changes: 10 additions & 1 deletion cards/faq-accordion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] {
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';
let profileAnswer = '';
if (profile.answerV2 && profile.answerV2.html) {
profileAnswer = profile.answerV2.html;
} else if (profile.answerV2 && profile.answerV2.json) {
console.warn('JSON is not supported, please convert to HTML.')
} else if (profile.answer) {
profileAnswer = ANSWERS.formatRichText(profile.answer, "answer", linkTarget);
}

return {
title: profile.question || profile.name, // The header text of the card
// subtitle: '', // The sub-header text of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card
details: profileAnswer ? profileAnswer : 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.
// showMoreDetails: {
Expand Down
11 changes: 10 additions & 1 deletion cards/multilang-faq-accordion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';
let profileAnswer = '';
if (profile.answerV2 && profile.answerV2.html) {
profileAnswer = profile.answerV2.html;
} else if (profile.answerV2 && profile.answerV2.json) {
console.warn('JSON is not supported, please convert to HTML.')
} else if (profile.answer) {
profileAnswer = ANSWERS.formatRichText(profile.answer, "answer", linkTarget);
}

return {
title: profile.question || profile.name, // The header text of the card
// subtitle: '', // The sub-header text of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card
details: profileAnswer ? profileAnswer : 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.
// showMoreDetails: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "answers-hitchhiker-theme",
"version": "1.32.0",
"version": "1.33.0",
"description": "A starter Search theme for hitchhikers",
"keywords": [
"jambo",
Expand Down
4 changes: 2 additions & 2 deletions static/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "answers-hitchhiker-theme",
"version": "1.32.0",
"version": "1.33.0",
"description": "Toolchain for use with the HH Theme",
"main": "Gruntfile.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ msgstr ""

#: cards/multilang-document-standard/component.js:53
#: cards/multilang-event-standard/component.js:53
#: cards/multilang-faq-accordion/component.js:51
#: cards/multilang-faq-accordion/component.js:60
#: cards/multilang-financial-professional-location/component.js:69
#: cards/multilang-job-standard/component.js:44
#: cards/multilang-link-standard/component.js:32
Expand All @@ -171,7 +171,7 @@ msgstr[1] ""

#: cards/multilang-document-standard/component.js:54
#: cards/multilang-event-standard/component.js:54
#: cards/multilang-faq-accordion/component.js:52
#: cards/multilang-faq-accordion/component.js:61
#: cards/multilang-financial-professional-location/component.js:70
#: cards/multilang-job-standard/component.js:45
#: cards/multilang-link-standard/component.js:33
Expand All @@ -191,7 +191,7 @@ msgstr ""

#: cards/multilang-document-standard/component.js:55
#: cards/multilang-event-standard/component.js:55
#: cards/multilang-faq-accordion/component.js:53
#: cards/multilang-faq-accordion/component.js:62
#: cards/multilang-financial-professional-location/component.js:71
#: cards/multilang-job-standard/component.js:46
#: cards/multilang-link-standard/component.js:34
Expand Down

0 comments on commit 0222c71

Please sign in to comment.