Skip to content

Commit

Permalink
Merge pull request #2846 from uktrade/develop
Browse files Browse the repository at this point in the history
Release to master
  • Loading branch information
bobby-didcoding authored Jan 22, 2024
2 parents 0bf4c86 + bf4b45b commit 2e67225
Show file tree
Hide file tree
Showing 24 changed files with 360 additions and 77 deletions.
8 changes: 4 additions & 4 deletions activitystream/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _prep_richtext_for_indexing(self, rich_text_value: str) -> str:

def to_representation(self, obj):
return {
'id': ('dit:greatCms:Article:' + str(obj.id) + ':Update'),
'id': 'dit:greatCms:Article:' + str(obj.id) + ':Update',
'type': 'Update',
'published': obj.last_published_at.isoformat('T'),
'object': {
Expand Down Expand Up @@ -77,7 +77,7 @@ def _get_article_body_content_for_search(self, obj: ArticlePage) -> str:

def to_representation(self, obj):
return {
'id': ('dit:greatCms:Article:' + str(obj.id) + ':Update'),
'id': 'dit:greatCms:Article:' + str(obj.id) + ':Update',
'type': 'Update',
'published': obj.last_published_at.isoformat('T'),
'object': {
Expand Down Expand Up @@ -134,7 +134,7 @@ def _get_microsite_body_content_for_search(self, obj: MicrositePage) -> str:

def to_representation(self, obj):
return {
'id': ('dit:greatCms:Microsite:' + str(obj.id) + ':Update'),
'id': 'dit:greatCms:Microsite:' + str(obj.id) + ':Update',
'type': 'Update',
'published': obj.last_published_at.isoformat('T'),
'object': {
Expand All @@ -144,7 +144,7 @@ def to_representation(self, obj):
'summary': obj.page_teaser,
'content': self._get_microsite_body_content_for_search(obj),
'url': f'https://www.great.gov.uk{obj.get_url()}',
'locale_id': obj.locale_id
'locale_id': obj.locale_id,
# 'keywords': ' '.join(obj.tags.all().values_list('name', flat=True)),
},
}
Expand Down
1 change: 1 addition & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application
Expand Down
22 changes: 11 additions & 11 deletions contact/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,44 @@ class ContactUsGuidanceSnippet(
# if we need to trace through where content goes)
snippet_slugs.HELP_EXOPP_ALERTS_IRRELEVANT: {
'title': 'Guidance - Daily alerts are not relevant',
'page_path': ('/contact/triage/export-opportunities/alerts-not-relevant/'),
'page_path': '/contact/triage/export-opportunities/alerts-not-relevant/',
},
snippet_slugs.HELP_EXOPPS_NO_RESPONSE: {
'title': 'Guidance - Export Opportunity application no response',
'page_path': ('/contact/triage/export-opportunities/opportunity-no-response/'),
'page_path': '/contact/triage/export-opportunities/opportunity-no-response/',
},
snippet_slugs.HELP_MISSING_VERIFY_EMAIL: {
'title': 'Guidance - Email verification missing',
'page_path': ('/contact/triage/great-account/no-verification-email/'),
'page_path': '/contact/triage/great-account/no-verification-email/',
},
snippet_slugs.HELP_PASSWORD_RESET: {
'title': 'Guidance - Missing password reset link',
'page_path': ('/contact/triage/great-account/password-reset/'),
'page_path': '/contact/triage/great-account/password-reset/',
},
snippet_slugs.HELP_COMPANIES_HOUSE_LOGIN: {
'title': 'Guidance - Companies House login not working',
'page_path': ('/contact/triage/great-account/companies-house-login/'),
'page_path': '/contact/triage/great-account/companies-house-login/',
},
snippet_slugs.HELP_VERIFICATION_CODE_ENTER: {
'title': 'Guidance - Where to enter letter verification code',
'page_path': ('/contact/triage/great-account/verification-letter-code/'),
'page_path': '/contact/triage/great-account/verification-letter-code/',
},
snippet_slugs.HELP_VERIFICATION_CODE_LETTER: {
'title': 'Guidance - Verification letter not delivered',
'page_path': ('/contact/triage/great-account/no-verification-letter/'),
'page_path': '/contact/triage/great-account/no-verification-letter/',
},
snippet_slugs.HELP_VERIFICATION_CODE_MISSING: {
'title': 'Guidance - Verification code not delivered',
'page_path': ('/contact/triage/great-account/verification-missing/'),
'page_path': '/contact/triage/great-account/verification-missing/',
},
snippet_slugs.HELP_ACCOUNT_COMPANY_NOT_FOUND: {
'title': 'Guidance - Company not found',
'page_path': ('/contact/triage/great-account/company-not-found/'),
'page_path': '/contact/triage/great-account/company-not-found/',
},
snippet_slugs.HELP_EXPORTING_TO_UK: {
# NB snippet_slugs.HELP_EXPORTING_TO_UK is NOT bootstrapped via data migration
'title': 'Guidance - Exporting to the UK',
'page_path': ('contact/triage/international/exporting-to-the-uk/'),
'page_path': 'contact/triage/international/exporting-to-the-uk/',
},
}

Expand Down Expand Up @@ -119,7 +119,7 @@ class ContactSuccessSnippet(
},
snippet_slugs.HELP_FORM_SUCCESS_DSO: {
'title': 'Contact Defence and Security Organisation form success page content',
'page_path': ('/contact/defence-and-security-organisation/success/'),
'page_path': '/contact/defence-and-security-organisation/success/',
},
snippet_slugs.HELP_FORM_SUCCESS_EXPORT_ADVICE: {
'title': 'Contact exporting from the UK form success page content',
Expand Down
Binary file added core/components/static/icons/event-icon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/components/static/icons/series-icon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Generated by Django 4.1.13 on 2024-01-12 17:57

import django.db.models.deletion
import modelcluster.fields
import wagtail.blocks
import wagtail.fields
import wagtail.snippets.blocks
from django.db import migrations, models

import core.blocks


class Migration(migrations.Migration):

dependencies = [
('export_academy', '0033_alter_coursepage_metadata_alter_coursepage_reviews'),
('core', '0129_alter_greatmedia_subtitles_en_and_more'),
]

operations = [
migrations.CreateModel(
name='UKEACTA',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
(
'image',
wagtail.fields.StreamField(
[
(
'media',
wagtail.blocks.StreamBlock([('image', core.blocks.ImageBlock())], max_num=1, min_num=1),
)
],
blank=True,
null=True,
use_json_field=True,
),
),
('name', models.CharField(help_text='Snippet name', max_length=50)),
],
options={
'verbose_name': 'UKEA CTA',
'verbose_name_plural': "UKEA CTA's",
},
),
migrations.AddField(
model_name='detailpage',
name='call_to_action',
field=wagtail.fields.StreamField(
[
(
'ukea_article_cta',
wagtail.blocks.ListBlock(
wagtail.snippets.blocks.SnippetChooserBlock('core.UKEACTA'),
icon='link',
label='UKEA Call to action',
max_num=1,
template='learn/includes/article_page_cta.html',
),
)
],
blank=True,
null=True,
use_json_field=True,
),
),
migrations.CreateModel(
name='EventOrderable',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
(
'event',
models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='export_academy.event'
),
),
(
'page',
modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE, related_name='ukea_cta_links', to='core.ukeacta'
),
),
(
'series',
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to='export_academy.coursepage',
),
),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]
70 changes: 69 additions & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,6 @@ def is_lesson_page(self, page):


class LessonPlaceholderPage(Page, mixins.AuthenticatedUserRequired if not settings.FEATURE_DEA_V2 else object):

"""Structural page to allow for configuring and representing very simple
to modules (`CuratedListPage`s).
Expand Down Expand Up @@ -906,6 +905,24 @@ class Meta:
use_json_field=True,
)

call_to_action = StreamField(
[
(
'ukea_article_cta',
blocks.ListBlock(
SnippetChooserBlock('core.UKEACTA'),
template='learn/includes/article_page_cta.html',
label='UKEA Call to action',
max_num=1,
icon='link',
),
)
],
use_json_field=True,
null=True,
blank=True,
)

def get_steps(self):
topics = CuratedListPage.objects.live()
return [{'text': page.title, 'url': page.url} for page in topics]
Expand All @@ -929,6 +946,7 @@ def get_current_module(self):
FieldPanel('objective'),
FieldPanel('body'),
FieldPanel('recap'),
FieldPanel('call_to_action'),
]

@cached_classmethod
Expand Down Expand Up @@ -1042,6 +1060,56 @@ def get_context(self, request, *args, **kwargs):
return context


class EventOrderable(Orderable):
"""
This allows us to either series or multiple events
"""

page = ParentalKey('core.UKEACTA', related_name='ukea_cta_links')
event = models.ForeignKey('export_academy.Event', on_delete=models.SET_NULL, null=True, blank=True)
series = models.ForeignKey('export_academy.CoursePage', on_delete=models.SET_NULL, null=True, blank=True)

panels = [FieldPanel('event'), FieldPanel('series')]


@register_snippet
class UKEACTA(ClusterableModel):
image = StreamField(
[
(
'media',
blocks.StreamBlock(
[
('image', core_blocks.ImageBlock()),
],
min_num=1,
max_num=1,
),
),
],
use_json_field=True,
blank=True,
null=True,
)
name = models.CharField(max_length=50, help_text='Snippet name')
panels = [
FieldPanel('image'),
FieldPanel('name'),
MultiFieldPanel(
[InlinePanel('ukea_cta_links', label='Link')],
heading='Link(s)',
icon='link',
),
]

class Meta:
verbose_name = 'UKEA CTA'
verbose_name_plural = "UKEA CTA's"

def __str__(self):
return self.name


@register_snippet
class RelatedContentCTA(models.Model):
type_choices = [
Expand Down
8 changes: 5 additions & 3 deletions export_academy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ def get_ics_button(event, on_confirmation):
f'Add to calendar<span class="great-visually-hidden">{event.name}</span>',
'value': 'Confirmed',
'type': 'submit',
'classname': 'govuk-button ukea-ga-tracking govuk-!-margin-bottom-0'
if on_confirmation
else 'govuk-button govuk-button--secondary ukea-ga-tracking govuk-!-margin-bottom-0',
'classname': (
'govuk-button ukea-ga-tracking govuk-!-margin-bottom-0'
if on_confirmation
else 'govuk-button govuk-button--secondary ukea-ga-tracking govuk-!-margin-bottom-0'
),
}


Expand Down
Loading

0 comments on commit 2e67225

Please sign in to comment.