Skip to content

Commit

Permalink
VACMS-10940 Consolidate reusable and page-specific Q&As on CLPs
Browse files Browse the repository at this point in the history
  • Loading branch information
randimays committed Apr 4, 2024
1 parent 8178240 commit b38d48e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/site/layouts/campaign_landing_page.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
{% 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 %}
{% include "src/site/paragraphs/q_a_group_collapsible_content_clp.drupal.liquid" with entity = reusableQA.entity %}
{% else %}
{% include "src/site/paragraphs/q_a_group_content.drupal.liquid" with entity = reusableQA.entity %}
{% endif %}
Expand Down
56 changes: 56 additions & 0 deletions src/site/paragraphs/q_a.collapsible_panel_clp.drupal.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{% comment %}
This is a special implementation for Campaign Landing pages
They can have page-specific Q&As as well as reusable Q&A sections back to back
Because the header of the reusable Q&A section is not required, this can cause
unnecessary separations between different accordion sections at the bottom of the page.
To remedy this, we have two scenarios:
1. If a reusable Q&A accordion section is added, but the header is empty,
use the "Frequently Asked Questions" header (that is sent for the page-specific Q&As)
and combine all header-less reusable Q&As with the page-specific Q&As under the FAQ header
2. If a reusable Q&A accordion section is added and the header is given,
use the header given by the reusable Q&A section and add the page-specific Q&As before the reusable Q&As
in that section
{% endcomment %}

<div data-template="paragraphs/q_a.collapsible_panel">
<va-accordion uswds>

{% assign questions = entity.fieldQuestions %}
{% assign sectionHeader = entity.fieldSectionHeader %}

{% for accordionItem in questions %}
{% assign item = accordionItem.entity %}
{% assign id = item.entityId %}

<va-accordion-item
class="va-accordion-item"
header="{{ item.fieldQuestion }}"
id="{{ item.fieldQuestion | hashReference: 60 }}"
{% if level %}
level="{{ level }}"
{% else %}
level=3
{% endif %}
>
<div
id={{ id }}
data-template="paragraphs/q_a.collapsible_panel__qa"
data-entity-id="{{ id }}"
data-analytics-faq-section="{{ sectionHeader | escape }}"
data-analytics-faq-text="{{ item.fieldQuestion | escape }}"
>
<div id="{{ item.entityBundle }}-{{ id }}">
{% for answer in item.fieldAnswer %}
{% assign bundleComponent = "src/site/paragraphs/" | append: answer.entity.entityBundle | append: ".drupal.liquid" %}
{% include {{ bundleComponent }} with entity = answer.entity %}
{% endfor %}
</div>
</div>
</va-accordion-item>
{% endfor %}
</va-accordion>
</div>

0 comments on commit b38d48e

Please sign in to comment.