Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1008 from uktrade/feature/ioo-1120_alignment-to-eyb
Browse files Browse the repository at this point in the history
Removing contact us across app and conditional logic for showing expand your business (great-cms) link on opportunities
  • Loading branch information
stuart-mindt authored Feb 15, 2024
2 parents e6f2e54 + af2e93d commit f92bacf
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 169 deletions.
1 change: 0 additions & 1 deletion conf/tests/test_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def test_redirects(url, expected, client):
'/international/invest/perfectfit/', # needs PIR API call mocked

# just a light check of SOME but not all views
'/international/contact/',
'/international/invest/contact/',
'/international/invest/contact/success/',
'/international/expand/contact/',
Expand Down
20 changes: 0 additions & 20 deletions conf/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,3 @@ def test_url_redirect_industries_to_about_uk_page_off(client, settings):

with pytest.raises(NoReverseMatch):
reverse('industries-to-about-uk-redirect')


def test_url_redirect_international_contact_triage_on(client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = True
reload_urlconf(settings)

assert reverse('international-contact-triage')

with pytest.raises(NoReverseMatch):
reverse('contact-page-international')


def test_url_redirect_international_contact_triage_off(client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = False
reload_urlconf(settings)

assert reverse('contact-page-international')

with pytest.raises(NoReverseMatch):
reverse('international-contact-triage')
17 changes: 0 additions & 17 deletions conf/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,6 @@
),
]

# This route remains in use after the Atlas refactor
if settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON']:
urlpatterns += [
re_path(
r'^international/contact/$',
core.views.InternationalContactTriageView.as_view(),
name='international-contact-triage'
),
]
else:
urlpatterns += [
re_path(
r'^international/contact/$',
core.views.InternationalContactPageView.as_view(),
name='contact-page-international'
),
]

urlpatterns += [
re_path(
Expand Down
2 changes: 1 addition & 1 deletion core/header_config/tier_two_nav_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

WHY_INVEST_IN_UK = NavItem(
name='why-invest-in-the-uk',
title=_('Why choose the UK?'),
title=_('Why choose the UK'),
url=WHY_INVEST_IN_THE_UK_URL
)

Expand Down
2 changes: 1 addition & 1 deletion core/templates/atlas/components/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
href="https://www.great.gov.uk/accessibility-statement/" target="_blank">{% trans 'Accessibility' %}</a>
</li>
<li>
<a id="footer-contact" href="{{ services_urls.contact_us_international }}">
<a id="footer-contact" href="/international/expand-your-business-in-the-uk/contact">
{% trans 'Contact us' %}</a>
</li>
<li>
Expand Down
57 changes: 1 addition & 56 deletions core/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
from django.urls import reverse

from conf.tests.test_urls import reload_urlconf
from core import constants
from core.forms import CapitalInvestContactForm
from core.tests.helpers import create_response, stub_page, dummy_page
from core.tests.helpers import create_response, stub_page
from core.views import (
MultilingualCMSPageFromPathView,
CapitalInvestContactFormView,
InternationalContactTriageView,
WhyBuyFromUKFormView,
WhyBuyFromUKFormViewSuccess
)
Expand Down Expand Up @@ -247,19 +245,6 @@ def test_capital_invest_contact_form_success_page_returns_404_when_feature_flag_
assert response.status_code == 404


@patch('directory_cms_client.client.cms_api_client.lookup_by_path')
def test_international_contact_form(mock_cms_response, client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = False
reload_urlconf(settings)

mock_cms_response.return_value = create_response(dummy_page)

url = reverse('contact-page-international')
response = client.get(url)

assert response.status_code == 200


@pytest.fixture
def capital_invest_contact_form_data(captcha_stub):
return {
Expand Down Expand Up @@ -632,46 +617,6 @@ def test_about_uk_breadcrumbs_article_page_feature_off(
assert response.context_data['page']['tree_based_breadcrumbs'][0]['title'] == 'Why choose the UK'


@pytest.mark.parametrize(
'choice_contact_url',
[constants.INVEST_CONTACT_URL, constants.CAPITAL_INVEST_CONTACT_URL, constants.EXPORTING_TO_UK_CONTACT_URL,
constants.BUYING_CONTACT_URL]
)
def test_international_contact_triage_redirects(
choice_contact_url, client, feature_flags
):
feature_flags['INTERNATIONAL_TRIAGE_ON'] = True
feature_flags['EXPORTING_TO_UK_ON'] = True
feature_flags['CAPITAL_INVEST_CONTACT_IN_TRIAGE_ON'] = True

response = client.post('/international/contact/', {'choice': choice_contact_url})
assert response.status_code == 302
assert response.url == choice_contact_url


@patch('directory_cms_client.client.cms_api_client.lookup_by_path')
def test_international_contact_triage_view(
mock_cms_response, rf
):
page = {
'title': 'Midlands',
'meta': {
'languages': [
['en-gb', 'English'],
]
}
}

mock_cms_response.return_value = create_response(page)

request = rf.get('/international/contact/')
request.LANGUAGE_CODE = 'en-gb'
response = InternationalContactTriageView.as_view()(
request, path='/international/contact/')

assert 'domestic_contact_home' in response.context_data


@pytest.fixture
def why_buy_from_uk_form_data(captcha_stub):
return {
Expand Down
53 changes: 1 addition & 52 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from directory_constants import urls
from directory_components.helpers import SocialLinkBuilder
from directory_components.mixins import (
CMSLanguageSwitcherMixin, GA360Mixin, CountryDisplayMixin, EnableTranslationsMixin)
CMSLanguageSwitcherMixin, GA360Mixin, EnableTranslationsMixin)

from core import forms, helpers, constants
from core.context_modifiers import register_context_modifier, registry as context_modifier_registry
Expand Down Expand Up @@ -162,27 +162,6 @@ def sector_landing_page_context_modifier(context, request):
}


class InternationalContactPageView(CountryDisplayMixin, InternationalView):
template_name = 'core/contact_page.html'
header_section = tier_one_nav_items.CONTACT

def __init__(self):
super().__init__()
self.set_ga360_payload(
page_id='InternationalContactPage',
business_unit='GreatInternational',
site_section='Contact',
site_subsection='ContactForm'
)

def get_context_data(self, *args, **kwargs):
return super().get_context_data(
hide_language_selector=True,
invest_contact_us_url=urls.international.EXPAND_CONTACT,
*args, **kwargs
)


class SendContactNotifyMessagesMixin:
def send_company_message(self, form):
sender = directory_forms_api_client.helpers.Sender(
Expand Down Expand Up @@ -522,33 +501,3 @@ def handler404(request, *args, **kwargs):

def handler500(request, *args, **kwargs):
return render(request, '500.html', status=500)


class InternationalContactTriageView(
GA360Mixin,
EnableTranslationsMixin,
InternationalHeaderMixin,
FormView,
):
template_name = 'core/contact_international_triage.html'
form_class = forms.InternationalRoutingForm
success_url = urls.domestic.CONTACT_US + 'international/'
header_section = tier_one_nav_items.CONTACT

def __init__(self):
super().__init__()
self.set_ga360_payload(
page_id='GreatInternationalContactTriage',
business_unit='GreatInternational',
site_section='GreatInternational',
site_subsection='ContactTriage'
)

def form_valid(self, form):
return redirect(form.cleaned_data['choice'])

def get_context_data(self, *args, **kwargs):
return super().get_context_data(
domestic_contact_home=urls.domestic.CONTACT_US,
*args, **kwargs,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@
{% endfor %}
</div>

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock content %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="atlas-bg--grey-darker atlas-colour--white">
<div class="atlas-container">
<div class="atlas-opportunity__contact atlas-grid">

<div class="atlas-grid__column atlas-grid__column atlas-p-t-xs">
<div class="atlas-opportunity__contact-cta">
{% if button_preamble %}
<h3 class="atlas-h--xs atlas-m-b-xs atlas-m-h-xs">
{{ button_preamble }}
</h3>
{% endif %}
<a href="/international/expand-your-business-in-the-uk/" class="atlas-button atlas-button--white atlas-m-b-xs">
Find out more
</a>
</div>
</div>

</div>
</div>
</div>

This file was deleted.

6 changes: 4 additions & 2 deletions investment_atlas/templates/investment_atlas/opportunity.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
</div>
</div>

{% if page.investment_type == 'Foreign direct investment' or page.investment_type == 'Freeport' %}
{% include 'investment_atlas/includes/contact_eyb.html' with button_preamble="Take advantage of this opportunity to expand and grow your business in the UK" %}
{% else %}
{% include 'investment_atlas/includes/contact.html' with button_preamble="Contact the opportunity lead" %}
{% endif %}

<div class="atlas-alternate-bg">
{% for section in page.main_content %}
Expand Down Expand Up @@ -131,6 +135,4 @@ <h2 class="atlas-h--l">Other opportunities</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
2 changes: 0 additions & 2 deletions investment_atlas/templates/investment_atlas/region.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,4 @@ <h2 class="atlas-h--l">{{ page.case_study_title }}</h2>
</section>
{% endif %}


{% include 'investment_atlas/includes/speak_to_us.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ <h2 class="atlas-h--l">Explore more of the Investment Atlas</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
2 changes: 0 additions & 2 deletions investment_atlas/templates/investment_atlas/topic_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ <h2 class="atlas-h--l">Explore more of the Investment Atlas</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ <h3 class="atlas-h--m">
</div>
</section>

{% include 'investment_atlas/includes/speak_to_us.html' %}
{% endblock %}

0 comments on commit f92bacf

Please sign in to comment.