From f1ede5bfd75bae495b9f48a6dc6e4860113ba55e Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Tue, 3 Sep 2024 10:25:03 -0700 Subject: [PATCH] Update BuyersGuideCallToAction with LinkBlock (#12630) * add new link field * migration operation to transfer the old data * removal of old fields * updated wagtail hook for displaying ctas in list view * frontend updates * removed unneeded tests, as we are no longer implementing custom validation through clean method * updated migrations * updated factory * updated migration numbers * updated streamfield provider and migration operation * updated migrations after merge with main * merge with main * updated migrations * formatting * updated test file to account for change in factory --------- Co-authored-by: Rob DiVincenzo --- .../fragments/buyersguide/arrow_link.html | 4 +- .../buyersguide/call_to_action_box.html | 10 +- .../templates/pages/buyersguide/catalog.html | 2 +- .../editorial_content_index_page.html | 4 +- .../templates/pages/buyersguide/home.html | 2 +- .../pages/buyersguide/product_page.html | 2 +- .../utility/faker/streamfield_provider.py | 12 ++ .../wagtailpages/factory/buyersguide.py | 3 +- .../0159_update_bgcta_with_linkblock.py | 130 +++++++++++ .../pagemodels/buyersguide/call_to_action.py | 72 ++----- .../tests/buyersguide/test_call_to_action.py | 203 ------------------ .../networkapi/wagtailpages/wagtail_hooks.py | 2 +- tests/integration/pni/search.spec.js | 2 +- 13 files changed, 177 insertions(+), 271 deletions(-) create mode 100644 network-api/networkapi/wagtailpages/migrations/0159_update_bgcta_with_linkblock.py delete mode 100644 network-api/networkapi/wagtailpages/tests/buyersguide/test_call_to_action.py diff --git a/network-api/networkapi/templates/fragments/buyersguide/arrow_link.html b/network-api/networkapi/templates/fragments/buyersguide/arrow_link.html index ea4e49919ab..a0f9d2e9c5e 100644 --- a/network-api/networkapi/templates/fragments/buyersguide/arrow_link.html +++ b/network-api/networkapi/templates/fragments/buyersguide/arrow_link.html @@ -1,8 +1,8 @@ {% load static %} diff --git a/network-api/networkapi/templates/fragments/buyersguide/call_to_action_box.html b/network-api/networkapi/templates/fragments/buyersguide/call_to_action_box.html index 3d4211133be..b707aa07da0 100644 --- a/network-api/networkapi/templates/fragments/buyersguide/call_to_action_box.html +++ b/network-api/networkapi/templates/fragments/buyersguide/call_to_action_box.html @@ -38,9 +38,11 @@ {% endif %} - {% if link_text and link_href %} -
- {% include "./arrow_link.html" with link_href=link_href link_text=link_text %} -
+ {% if link %} + {% with link=link.0.value %} +
+ {% include "./arrow_link.html" with link=link %} +
+ {% endwith %} {% endif %} diff --git a/network-api/networkapi/templates/pages/buyersguide/catalog.html b/network-api/networkapi/templates/pages/buyersguide/catalog.html index 0c31382f448..e421d2c3022 100644 --- a/network-api/networkapi/templates/pages/buyersguide/catalog.html +++ b/network-api/networkapi/templates/pages/buyersguide/catalog.html @@ -138,7 +138,7 @@ data-show-for-categories="{% for category in categories %}{% if category.show_cta %}{{ category.name }}, {% endif %}{% endfor %}" > {% with cta=featured_cta %} - {% include "fragments/buyersguide/call_to_action_box.html" with icon=cta.sticker_image heading=cta.title body=cta.content link_text=cta.link_label link_href=cta.get_target_url large=True %} + {% include "fragments/buyersguide/call_to_action_box.html" with icon=cta.sticker_image heading=cta.title body=cta.content link=cta.link large=True %} {% endwith %} {% endif %} diff --git a/network-api/networkapi/templates/pages/buyersguide/editorial_content_index_page.html b/network-api/networkapi/templates/pages/buyersguide/editorial_content_index_page.html index 9fbf55d6ec0..658c3eb55b4 100644 --- a/network-api/networkapi/templates/pages/buyersguide/editorial_content_index_page.html +++ b/network-api/networkapi/templates/pages/buyersguide/editorial_content_index_page.html @@ -36,7 +36,7 @@

{{ page.title }}