-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into TP1-206-11455-pni_get_bg_home_page
- Loading branch information
Showing
13 changed files
with
177 additions
and
271 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
network-api/networkapi/templates/fragments/buyersguide/arrow_link.html
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{% load static %} | ||
|
||
<div class="tw-w-max"> | ||
<a href="{{ link_href }}" class="tw-flex tw-items-center tw-font-sans tw-text-base tw-font-bold tw-text-blue-80 tw-leading-5 tw-no-underline hover:tw-underline {{ extra_classes }}"> | ||
{{ link_text }} | ||
<a href="{{ link.url }}" {% if link.new_window %}target="_blank"{% endif %} class="tw-flex tw-items-center tw-font-sans tw-text-base tw-font-bold tw-text-blue-80 tw-leading-5 tw-no-underline hover:tw-underline {{ extra_classes }}"> | ||
{{ link.label }} | ||
<img src="{% static "_images/buyers-guide/arrow-right.svg" %}" class="tw-ml-2 " alt=""> | ||
</a> | ||
</div> |
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
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
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
130 changes: 130 additions & 0 deletions
130
network-api/networkapi/wagtailpages/migrations/0159_update_bgcta_with_linkblock.py
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,130 @@ | ||
# Generated by Django 4.2.14 on 2024-08-28 01:05 | ||
|
||
import wagtail.blocks | ||
import wagtail.documents.blocks | ||
import wagtail.fields | ||
from django.db import migrations | ||
|
||
import networkapi.wagtailpages.validators | ||
|
||
|
||
def migrate_link_field(apps, schema_editor): | ||
BuyersGuideCallToAction = apps.get_model("wagtailpages", "BuyersGuideCallToAction") | ||
for instance in BuyersGuideCallToAction.objects.all(): | ||
|
||
stream_data = [] | ||
|
||
if instance.link_label and (instance.link_target_url or instance.link_target_page): | ||
if instance.link_target_url: | ||
link_value = { | ||
"link_to": "external_url", | ||
"external_url": instance.link_target_url, | ||
"label": instance.link_label, | ||
"new_window": False, | ||
} | ||
stream_data = [("link", link_value)] | ||
|
||
elif instance.link_target_page: | ||
link_value = { | ||
"link_to": "page", | ||
"label": instance.link_label, | ||
"new_window": False, | ||
"page": instance.link_target_page, | ||
} | ||
stream_data = [("link", link_value)] | ||
|
||
instance.link = stream_data | ||
instance.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("wagtailpages", "0158_alter_blogpage_body_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="buyersguidecalltoaction", | ||
name="link", | ||
field=wagtail.fields.StreamField( | ||
[ | ||
( | ||
"link", | ||
wagtail.blocks.StructBlock( | ||
[ | ||
("label", wagtail.blocks.CharBlock()), | ||
( | ||
"link_to", | ||
wagtail.blocks.ChoiceBlock( | ||
choices=[ | ||
("page", "Page"), | ||
("external_url", "External URL"), | ||
("relative_url", "Relative URL"), | ||
("email", "Email"), | ||
("anchor", "Anchor"), | ||
("file", "File"), | ||
("phone", "Phone"), | ||
], | ||
label="Link to", | ||
), | ||
), | ||
("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), | ||
( | ||
"external_url", | ||
wagtail.blocks.URLBlock( | ||
help_text="Enter a full URL including http:// or https://", | ||
label="External URL", | ||
max_length=300, | ||
required=False, | ||
), | ||
), | ||
( | ||
"relative_url", | ||
wagtail.blocks.CharBlock( | ||
help_text='A path relative to this domain. For example, "/foo/bar" or "?foo=bar".', | ||
label="Relative URL", | ||
max_length=300, | ||
required=False, | ||
validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], | ||
), | ||
), | ||
( | ||
"anchor", | ||
wagtail.blocks.CharBlock( | ||
help_text='An id attribute of an element on the current page. For example, "#section-1"', | ||
label="#", | ||
max_length=300, | ||
required=False, | ||
validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], | ||
), | ||
), | ||
("email", wagtail.blocks.EmailBlock(required=False)), | ||
("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), | ||
("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), | ||
( | ||
"new_window", | ||
wagtail.blocks.BooleanBlock(label="Open in new window", required=False), | ||
), | ||
] | ||
), | ||
) | ||
], | ||
blank=True, | ||
use_json_field=True, | ||
), | ||
), | ||
migrations.RunPython(migrate_link_field), | ||
migrations.RemoveField( | ||
model_name="buyersguidecalltoaction", | ||
name="link_label", | ||
), | ||
migrations.RemoveField( | ||
model_name="buyersguidecalltoaction", | ||
name="link_target_page", | ||
), | ||
migrations.RemoveField( | ||
model_name="buyersguidecalltoaction", | ||
name="link_target_url", | ||
), | ||
] |
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
Oops, something went wrong.