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

VACMS-10940 Consolidate reusable and page-specific Q&As on CLPs #2050

Merged
merged 5 commits into from
Jun 18, 2024
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
70 changes: 59 additions & 11 deletions src/site/layouts/campaign_landing_page.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,19 @@
<div class="vads-l-col--12 medium-screen:vads-l-col--8">
<!-- Title -->
<p class="va-u-text-transform--uppercase vads-u-color--gray-medium vads-u-font-size--sm vads-u-margin-bottom--0">FAQ</p>
<h2 class="vads-u-margin-top--0">Frequently asked questions</h2>

{% if fieldClpReusableQA and fieldClpReusableQA.entity.fieldSectionHeader %}
{% assign sectionHeader = fieldClpReusableQA.entity.fieldSectionHeader %}
{% else %}
{% assign sectionHeader = "Frequently asked questions" %}
{% endif %}

<h2 class="vads-u-margin-top--0">{{ sectionHeader }}</h2>

<!-- Optional QA Group Introduction -->
{% if fieldClpReusableQA and fieldClpReusableQA.entity.fieldRichWysiwyg.processed %}
{{ fieldClpReusableQA.entity.fieldRichWysiwyg.processed }}
{% endif %}

<!-- Page-specific Questions/Answers -->
<va-accordion bordered uswds>
Expand All @@ -480,18 +492,54 @@
</va-accordion-item>
{% endif %}
{% endfor %}
</va-accordion>

<!-- Reusable QAs -->
{% for reusableQA in fieldClpReusableQA %}
{% if reusableQA.entity.entityBundle == "q_a_group" %}
{% if reusableQA.entity.fieldAccordionDisplay %}
{% include "src/site/paragraphs/q_a_group_collapsible_content.drupal.liquid" with entity = reusableQA.entity %}
{% else %}
{% include "src/site/paragraphs/q_a_group_content.drupal.liquid" with entity = reusableQA.entity %}
{% endif %}
<!-- Reusable QAs -->
{% if fieldClpReusableQA %}
{% assign questions = fieldClpReusableQA.entity.queryFieldQAs.entities %}

{% if fieldClpReusableQA.entity.entityBundle == "q_a_group" %}
{% if fieldClpReusableQA.entity.fieldAccordionDisplay %}
{% for item in questions %}
{% assign id = item.entityId %}

<va-accordion-item
bordered
class="va-accordion-item"
header="{{ item.entityLabel }}"
id="{{ item.entityLabel | hashReference: 60 }}"
level=3
>
<div
id={{ id }}
data-entity-id="{{ id }}"
data-analytics-faq-section="{{ sectionHeader | escape }}"
data-analytics-faq-text="{{ item.entityLabel | escape }}"
>
<div id="{{ item.entityBundle }}-{{ id }}">
{% assign bundleComponent = "src/site/paragraphs/" | append: item.fieldAnswer.entity.entityBundle | append: ".drupal.liquid" %}
{% include {{ bundleComponent }} with entity = item.fieldAnswer.entity %}
</div>
</div>
</va-accordion-item>
{% endfor %}
{% else %}
{% assign entity = fieldClpReusableQA.entity %}
{% assign fieldQAs = entity.queryFieldQAs.entities %}

{% for fieldQA in fieldQAs %}
<h3>{{ fieldQA.entityLabel }}</h3>
{% if fieldQA.fieldAnswer %}
{% assign fieldAnswer = fieldQA.fieldAnswer %}
{% assign bundleComponent = "src/site/paragraphs/" | append: fieldAnswer.entity.entityBundle %}
{% assign bundleComponentWithExtension = bundleComponent | append: ".drupal.liquid" %}
{% include {{ bundleComponentWithExtension }} with entity = fieldAnswer.entity %}
{% endif %}
</ul>
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</va-accordion>
</div>
</div>

Expand Down
Loading