Skip to content

Commit

Permalink
Merge pull request #2844 from uktrade/develop
Browse files Browse the repository at this point in the history
UAT/Prod Release
  • Loading branch information
divyaparameswaran authored Jan 17, 2024
2 parents 553b946 + 8bd01a1 commit 0bf4c86
Show file tree
Hide file tree
Showing 138 changed files with 1,196 additions and 1,646 deletions.
2 changes: 1 addition & 1 deletion activitystream/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def to_representation(self, obj):


class ArticlePageSerializer(serializers.Serializer):
expected_block_types = ['text', 'cta', 'image', 'Video', 'Columns', 'pull_quote']
expected_block_types = ['text', 'cta', 'data_table', 'image', 'Video', 'Columns', 'pull_quote']

def _get_article_body_content_for_search(self, obj: ArticlePage) -> str:
"""Selectively extract streamfield data from the blocks in ArticlePage's article_body streamfield.
Expand Down
4 changes: 0 additions & 4 deletions config/url_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,6 @@
r'^finance/$|^advice/get-export-finance-and-funding/$',
PermanentQuerystringRedirectView.as_view(url='https://www.ukexportfinance.gov.uk/'),
),
re_path(
r'^trade-finance/$',
PermanentQuerystringRedirectView.as_view(url='https://www.ukexportfinance.gov.uk/'),
),
re_path(
r'^getting-paid/invoice-currency-and-contents/$|^getting-paid/payment-methods/$|^advice/manage-payment-for-export-orders/payment-methods-for-exporters/$', # noqa:E501
PermanentQuerystringRedirectView.as_view(
Expand Down
16 changes: 8 additions & 8 deletions core/js/largevideoupload/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export const createElement = (el, options = []) => {
export const isFormValid = (file) => {
const titleVal = document.querySelector('#id_title').value
const fileNameLength = file.name.length
const transcriptVal = document.querySelector('#id_transcript').value
const englishSubtitlesVal = document.querySelector('#id_subtitles_en').value

const isTitleValid = titleVal !== ''
const isFileNameValid = fileNameLength <= 100
const isTranscriptValid = transcriptVal !== ''
const isEnglishSubtitleValid = englishSubtitlesVal !== ''

const isValid = isTitleValid && isTranscriptValid && isFileNameValid
const isValid = isTitleValid && isFileNameValid && isEnglishSubtitleValid

if (isValid) {
document.querySelector('.messages').innerHTML = ''
Expand All @@ -48,16 +48,16 @@ export const isFormValid = (file) => {
field: 'title',
errorMessage: ' This field is required.',
},
{
isValid: isTranscriptValid,
field: 'transcript',
errorMessage: ' This field is required.',
},
{
isValid: isFileNameValid,
field: 'file',
errorMessage: ' Filename cannot exceed 100 characters.',
},
{
isValid: isEnglishSubtitleValid,
field: 'subtitles_en',
errorMessage: ' This field is required.',
},
]

fields.forEach(({ isValid, field, errorMessage }) => {
Expand Down
4 changes: 2 additions & 2 deletions core/js/largevideoupload/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ describe('Wagtail utils', () => {
'<div class="messages"></div>' +
' <div data-contentpath="title"><div class="w-field__errors"></div><input type"text" id="id_title" /></div>' +
' <div data-contentpath="file"><div class="w-field__errors"></div><input type"file" id="id_file" /></div>' +
' <div data-contentpath="transcript"><div class="w-field__errors"></div><input type"text" id="id_transcript" /></div>' +
' <div data-contentpath="subtitles_en"><div class="w-field__errors"></div><input type"textarea" id="id_subtitles_en" /></div>' +
'</div>'

expect(isFormValid(mockFile)).toBe(false)

document.querySelector('#id_title').value = 'test title'
document.querySelector('#id_transcript').value = 'test transcript'
document.querySelector('#id_subtitles_en').value = 'test english subtitles'

expect(isFormValid(mockFile)).toBe(true)
})
Expand Down
26 changes: 26 additions & 0 deletions core/migrations/0129_alter_greatmedia_subtitles_en_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.1.13 on 2024-01-11 11:56

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
('core', '0128_alter_sharesettings_hashtags'),
]

operations = [
migrations.AlterField(
model_name='greatmedia',
name='subtitles_en',
field=models.TextField(
help_text='English-language subtitles for this video, in VTT format, Required for Level A WCAG compliance.',
null=True,
verbose_name='English subtitles',
),
),
migrations.AlterField(
model_name='greatmedia',
name='transcript',
field=models.TextField(blank=True, null=True, verbose_name='Transcript'),
),
]
10 changes: 4 additions & 6 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@ class GreatMedia(Media):
verbose_name=_('Description'), blank=True, null=True # left null because was an existing field
)

transcript = models.TextField(
verbose_name=_('Transcript'), blank=False, null=True # left null because was an existing field
)
transcript = models.TextField(verbose_name=_('Transcript'), blank=True, null=True)

subtitles_en = models.TextField(
verbose_name=_('English subtitles'),
null=True,
blank=True,
help_text='English-language subtitles for this video, in VTT format',
)
blank=False,
help_text='English-language subtitles for this video, in VTT format, Required for Level A WCAG compliance.',
) # left null because was an existing field

admin_form_fields = Media.admin_form_fields + ('transcript', 'subtitles_en', 'description')

Expand Down
2 changes: 1 addition & 1 deletion core/rich_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def render_a(attrs):
return format_html('<a href="#{id}" id="{id}" data-id="{id}">', id=attrs['id'])
return format_html('<span id="{id}" data-id="{id}">', id=attrs['id'])


class AnchorIdentifierLinkHandler(LinkHandler):
Expand Down
4 changes: 2 additions & 2 deletions core/sass/components/_sign-up.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@
line-height: 34px;
}

i {
span.great-icon {
margin-right: 30px;
font-size: 1.5em;
font-size: 1.5em!important;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/sass/exportplan/_sections.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
padding: 0;
}

.hide-show-trigger:checked~div>label#hide-show-button>i {
.hide-show-trigger:checked~div>label#hide-show-button>span[role="img"] {
transform: rotate(90deg);
padding-right: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion core/sass/learn/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ $desktop: 1024px;
}
}

i {
span[role='img'] {
margin-bottom: 0;

@include tablet {
Expand Down
18 changes: 12 additions & 6 deletions core/templates/components/great/card.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n wagtailimages_tags %}
{% load add_govuk_classes tag_text_mapper url_type from content_tags %}
{% load add_govuk_classes add_card_govuk_classes tag_text_mapper url_type from content_tags %}
<div class="great-card{% if classes %} {{ classes }}{% endif %}">
{% if url %}
<a href="{{ url }}" {% if data_attr %}{{ data_attr }}{% endif %}>
Expand Down Expand Up @@ -35,11 +35,17 @@
{% if bypass_class_filter %}
<div>{{ content }}</div>
{% else %}
{% filter add_govuk_classes %}
<{{ content_tag|default:'div' }}
{% if tag %}class="govuk-!-margin-bottom-9"{% endif %}
>{{ content }}</{{ content_tag|default:'div' }}>
{% endfilter %}
{% if tag %}
{% filter add_card_govuk_classes %}
<{{ content_tag|default:'div' }}
>{{ content }}</{{ content_tag|default:'div' }}>
{% endfilter %}
{% else %}
{% filter add_govuk_classes %}
<{{ content_tag|default:'div' }}
>{{ content }}</{{ content_tag|default:'div' }}>
{% endfilter %}
{% endif %}
{% endif %}
{% endif %}
{% if tag and tag_icon %}
Expand Down
35 changes: 34 additions & 1 deletion core/templates/components/great/share.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if settings.core.ShareSettings.share_prefix and settings.core.ShareSettings.hashtags and settings.wagtailseo.SeoSettings.twitter_site %}
<div class="govuk-!-padding-top-3 great-share">
<{{ heading_level|default:'h2' }} class="govuk-heading-s">Share this page</{{ heading_level|default:'h2' }}>
<ul>
<ul class="govuk-!-margin-top-4">
<li class="govuk-!-margin-bottom-2">
<a href="mailto:?subject={{ settings.core.ShareSettings.share_prefix|urlencode }}&body={{ page_title|urlencode }}: {{ page_url }}"
target="_blank"
Expand Down Expand Up @@ -47,6 +47,39 @@
<span>X</span>
</a>
</li>
{% block body_js %}
<script>
const aria_copy_url_id = "aria-copy-url"

const copy_url_to_clipboard = async function (event) {
try {
await navigator.clipboard.writeText(window.location.href)
document.getElementById(aria_copy_url_id).innerHTML = "Link copied"
event.srcElement.innerHTML = "<span role='img' class='fa fa-check'></span> Link copied"
} catch (e) {
}
}

// assumming one share component per page hence [0]
let social_share_parent = document.querySelectorAll(".great-share ul")[0]
let li_btn_container = document.createElement("li")

let aria_copy_url = document.createElement("span")
aria_copy_url.setAttribute("id", aria_copy_url_id)
aria_copy_url.setAttribute("aria-live", "assertive")
aria_copy_url.classList.add("govuk-visually-hidden")
li_btn_container.appendChild(aria_copy_url)

let btn_copy_url = document.createElement("button")
btn_copy_url.classList.add("secondary-button", "small-button")
btn_copy_url.setAttribute("type", "button")
btn_copy_url.innerHTML = "<span role='img' class='fa fa-link'></span> Copy link"
btn_copy_url.addEventListener("click", copy_url_to_clipboard)
li_btn_container.appendChild(btn_copy_url)
social_share_parent.appendChild(li_btn_container)

</script>
{% endblock %}
</ul>
</div>
{% endif %}
17 changes: 9 additions & 8 deletions core/templates/core/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
{% path_match "^\/learn\/" as in_learning %}
<li>
<a id="header-link-learning"
class="govuk-!-padding-3 {% if in_learning %}active{% endif %}"
href="/learn/categories/">Learn to export</a>
class="govuk-!-padding-3 {% if in_learning %}active{% endif %}"
href="/learn/categories/">Learn to export</a>
</li>
{% endif %}
{% endif %}
{% if request.user.is_authenticated %}
{% path_match "^\/where-to-export\/" as in_targetmarkets %}
{% if not features.FEATURE_DEA_V2 %}
{% path_match "^\/learn\/" as in_learning %}
<li>
<a id="header-link-learning"
class="govuk-!-padding-3 {% if in_learning %}active{% endif %}"
href="/learn/categories/">Learn to export</a>
class="govuk-!-padding-3 {% if in_learning %}active{% endif %}"
href="/learn/categories/">Learn to export</a>
</li>
{% endif %}
<li>
Expand All @@ -65,7 +65,9 @@
data-reveal-button
data-reveal-modal
aria-controls="guides-menu">
Guides <i class="fas fa-chevron-down" aria-hidden="true"></i>
Guides <span role="img"
class="fas fa-chevron-down govuk-!-static-margin-left-2"
aria-hidden="true"></span>
</button>
<div id="guides-menu">
<ul>
Expand Down Expand Up @@ -95,10 +97,9 @@
<form id="magna-header-search-form"
class="magna-header__search govuk-!-margin-bottom-4"
action="{% url 'search:search' %}"
method="GET">
method="get">
<label for="magna-header-search-box" class="visually-hidden">Search</label>
<input id="magna-header-search-box"
class=""
type="text"
name="q"
placeholder="Search">
Expand Down
2 changes: 1 addition & 1 deletion core/templates/core/includes/_case_study_quote_block.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="quote bg-white br-xs m-t-xs p-t-xs p-b-xs p-r-xs p-f-l">
<div class="quote-block">
<div>
<i class="fas fa-quote-left text-blue-deep-50 block"></i>
<span role="img" class="fas fa-quote-left text-blue-deep-50 block"></span>
{{ quote }}
</div>
<div class="only-mobile m-v-xs attribution">
Expand Down
2 changes: 1 addition & 1 deletion core/templates/core/includes/_sidebar-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h4 class="h-m p-b-s p-t-0">
</h4>
<a class="button button--secondary --button-large" href={% if value.link %}{{ value.link.internal_link.get_url|default:value.link.external_link }}{% endif %}>
{% if value.read_time %}
<i class="fa fa-clock-o m-r-xxs" aria-hidden="true"></i>{{ value.read_time|format_timedelta }}
<span role="img" class="fa fa-clock-o m-r-xxs" aria-hidden="true"></span>{{ value.read_time|format_timedelta }}
{% else %}
Go
{% endif %}
Expand Down
32 changes: 16 additions & 16 deletions core/templates/core/includes/_target_table.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<span class="h-s"><i class="fa fa-clock-o m-r-xxs" aria-hidden="true"></i>25-34 years old<span>
<table class="table bg-black-20">
<thead>
<tr>
<th>total population</th>
<th>Access to internet</th>
<th>Consumer price index</th>
</tr>
</thead>
<tbody>
<tr>
<td>32.8 million</td>
<td>90%(367 million)</td>
</tr>
</tbody>
</table>
<span class="h-s"><span role="img" class="fa fa-clock-o m-r-xxs" aria-hidden="true"></span>25-34 years old</span>
<table class="table bg-black-20">
<thead>
<tr>
<th>total population</th>
<th>Access to internet</th>
<th>Consumer price index</th>
</tr>
</thead>
<tbody>
<tr>
<td>32.8 million</td>
<td>90%(367 million)</td>
</tr>
</tbody>
</table>
2 changes: 1 addition & 1 deletion core/templates/core/includes/backlink.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load wagtailcore_tags %}
<a href="{{ url }}" class="back-link h-m body-m-b {{ classes }}">
<i class="fas fa-arrow-circle-left"></i><span class="m-f-xs">{{ label }}</span>
<span role="img" class="great-icon fas fa-arrow-circle-left"></span><span class="m-f-xs">{{ label }}</span>
</a>
4 changes: 4 additions & 0 deletions core/templates/design-system/buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ <h2 class="govuk-heading-l">Buttons</h2>
<button class="govuk-button govuk-button--secondary">govuk-button--secondary</button>
<button class="govuk-button great-full-width-button">great-full-width-button</button>
<button class="govuk-button great-min-300-button">great-min-300-button</button>
<button class="secondary-button small-button">Small button</button>
<pre>
<code>
&lt;button class="govuk-button"&gt;govuk-button&lt;/button&gt;
Expand All @@ -16,6 +17,9 @@ <h2 class="govuk-heading-l">Buttons</h2>
&lt;button class="govuk-button great-min-300-button"&gt;
great-min-300-button
&lt;/button&gt;
&lt;button class="secondary-button small-button"&gt;
Small button
&lt;/button&gt;
</code>
</pre>
</section>
1 change: 1 addition & 0 deletions core/templates/design-system/share.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<section id="share" class="govuk-!-margin-top-9">
<h2 class="govuk-heading-l">Share</h2>
{% include 'components/great/share.html' with page_url=request.build_absolute_uri page_title='Example page title' %}
<br>
<pre>
<code>
&#123;% include 'components/great/share.html' with page_url=request.build_absolute_uri page_title='Example page title' %&#125;
Expand Down
2 changes: 1 addition & 1 deletion core/templates/microsites/blocks/streamfield.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="success-message-container">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"
rel="stylesheet">
<i class="fa fa-check"></i>
<span role="img" class="fa fa-check"></span>
{% trans "Information has been submitted successfully" as success_message_text %}
<p>{{ success_message_text }}</p>
</div>
Expand Down
Loading

0 comments on commit 0bf4c86

Please sign in to comment.