Skip to content

Commit

Permalink
Add UK influencer campaign page (Fixes mozilla#15841)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Jan 14, 2025
1 parent 9db97b8 commit 008524e
Show file tree
Hide file tree
Showing 8 changed files with 369 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bedrock/base/templates/base-protocol.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<!--<![endif]-->

<!--[if IE 9]>
{# IE9 has its own lib JS bundle containing dependencies for anaytics and consent management. #}
{# IE9 has its own lib JS bundle containing dependencies for analytics and consent management. #}
{{ js_bundle('lib-ie') }}
<![endif]-->
{% endblock %}
Expand Down
34 changes: 34 additions & 0 deletions bedrock/firefox/templates/firefox/landing/productivity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% extends "firefox/new/desktop/download.html" %}

{% block canonical_urls %}<meta name="robots" content="noindex,follow">{% endblock %}

{% set win_smi_download_id = 'partner-firefox-release-smi-smi-001-stub' %}
{% set mac_smi_download_id = 'partner-firefox-release-smi-smi-001' %}

{% block string_data %}
data-win-smi-id="{{ win_smi_download_id }}"
data-mac-smi-id="{{ mac_smi_download_id }}"
{% endblock %}

{% block primary_cta %}
{{ download_firefox(dom_id='download-primary', force_direct=True, download_location='primary cta') }}
{% endblock %}

{% block features_cta %}
{{ download_firefox(dom_id='download-features', force_direct=True, download_location='features cta') }}
{% endblock %}

{% block discover_cta %}
{{ download_firefox(dom_id='download-discover', force_direct=True, download_location='discover cta') }}
{% endblock %}

{% block js %}
{{ super() }}
{{ js_bundle('firefox_smi_download') }}
{% endblock %}
13 changes: 9 additions & 4 deletions bedrock/firefox/templates/firefox/new/desktop/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ <h1 class="mzp-c-wordmark mzp-t-wordmark-md mzp-t-product-firefox">{{ ftl('firef
<h2 class="mzp-has-zap-7">{{ ftl('firefox-desktop-download-get-the-browser') }}</h2>
<p>{{ ftl('firefox-desktop-download-no-shady') }}</p>
<div class="c-intro-download">
{{ download_firefox_thanks(locale_in_transition=True, download_location='primary cta') }}
{% block primary_cta %}
{{ download_firefox_thanks(locale_in_transition=True, download_location='primary cta') }}
{% endblock %}

<div class="c-intro-download-alt"><a href="{{ url('firefox.all') }}">{{ ftl('firefox-desktop-download-download-options') }}</a></div>

Expand Down Expand Up @@ -384,8 +386,9 @@ <h3 class="mzp-u-title-xs">{{ ftl('firefox-desktop-download-customize-your-brows
</ul>
</div>
</div>
{{ download_firefox_thanks(dom_id='download-features', locale_in_transition=True, download_location='features cta') }}

{% block features_cta %}
{{ download_firefox_thanks(dom_id='download-features', locale_in_transition=True, download_location='features cta') }}
{% endblock %}
</div>
</section>

Expand Down Expand Up @@ -545,7 +548,9 @@ <h3 class="mzp-u-title-xs">{{ ftl('firefox-desktop-download-picture-in-picture')
<p>{{ ftl('firefox-desktop-download-from-watching-a') }}</p>
</div>
</div>
{{ download_firefox_thanks(dom_id='download-discover', locale_in_transition=True, download_location='discover cta') }}
{% block discover_cta %}
{{ download_firefox_thanks(dom_id='download-discover', locale_in_transition=True, download_location='discover cta') }}
{% endblock %}
</section>

<section class="c-support">
Expand Down
2 changes: 2 additions & 0 deletions bedrock/firefox/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@
"firefox/firefox-20th/index.html",
active_locales=["de", "fr", "en-US", "en-CA", "en-GB"],
),
# Issue 15841 - UK influencer campaign
page("firefox/landing/productivity/", "firefox/landing/productivity.html", ftl_files="firefox/new/desktop", active_locales="en-GB"),
)

# Contentful
Expand Down
9 changes: 9 additions & 0 deletions media/js/firefox/landing/smi-download-init.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import SMIDownload from './smi-download.es6';

SMIDownload.init();
48 changes: 48 additions & 0 deletions media/js/firefox/landing/smi-download.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

const SMIDownload = {};

let winDownloadID;
let macDownloadID;

SMIDownload.createCustomDownloadURL = (link, id) => {
const url = new URL(link.href);
url.searchParams.set('product', id);
link.href = url;
};

SMIDownload.replaceWithCustomDownloadLinks = () => {
const downloadLinksWin = Array.from(
document.querySelectorAll(
'.download-button .download-list .download-link[data-download-version="win"]'
)
);
const downloadLinksMac = Array.from(
document.querySelectorAll(
'.download-button .download-list .download-link[data-download-version="osx"]'
)
);

downloadLinksWin.every((link) =>
SMIDownload.createCustomDownloadURL(link, winDownloadID)
);
downloadLinksMac.every((link) =>
SMIDownload.createCustomDownloadURL(link, macDownloadID)
);
};

SMIDownload.init = () => {
const strings = document.getElementById('strings');
winDownloadID = strings.getAttribute('data-win-smi-id');
macDownloadID = strings.getAttribute('data-mac-smi-id');

if (typeof window.URL === 'function' && winDownloadID && macDownloadID) {
SMIDownload.replaceWithCustomDownloadLinks();
}
};

export default SMIDownload;
6 changes: 6 additions & 0 deletions media/static-bundles.json
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,12 @@
"js/base/banners/fundraiser-experiment.es6.js"
],
"name": "fundraising-banner-experiment"
},
{
"files": [
"js/firefox/landing/smi-download-init.es6.js"
],
"name": "firefox_smi_download"
}
]
}
Loading

0 comments on commit 008524e

Please sign in to comment.