Skip to content

Commit

Permalink
Add WNP for Firefox 104 for es-ES, it, and pl [mozilla#12015]
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcook authored and pmac committed Aug 17, 2022
1 parent 12ac7fa commit b770177
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bedrock/firefox/templates/firefox/whatsnew/includes/fx104/tcp.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{#
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/whatsnew/base.html" %}

{% block page_title %}{{ ftl('whatsnew-page-title') }}{% endblock %}
{% block page_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %}

{% block page_css %}
{{ css_bundle('firefox_whatsnew_104_default') }}
{% endblock %}

{% block site_header %}{% endblock %}

{% block wnp_content %}
<section class="wnp-content-main mzp-l-content mzp-t-content-md">
<h2 class="wnp-main-title">{{ ftl('whatsnew-104-default-title') }}</h2>
{% include 'firefox/whatsnew/includes/fx104/tcp.html' %}
<p class="wnp-main-tagline">{{ ftl('whatsnew-104-default-body') }}</p>
<p class="wnp-main-cta">
<a class="mzp-c-button mzp-t-product" href="{{ url('firefox.set-as-default.thanks') }}" data-cta-text="Make Firefox your default browser" data-cta-type="button">
{{ ftl('whatsnew-104-default-cta') }}
</a>
</p>
<div class="wnp-alt-msg">
<p><strong>{{ ftl('whatsnew-104-default-all-set') }}</strong></p>
</div>
</section>
{% endblock %}

{% block js %}
{{ js_bundle('firefox_whatsnew') }}
{{ js_bundle('firefox_whatsnew_104_default') }}
{% endblock %}
20 changes: 20 additions & 0 deletions bedrock/firefox/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,26 @@ def test_fx_103_0_0_other_locales(self, render_mock):

# end 103.0 whatsnew tests

# begin 104.0 whatsnew tests

def test_fx_104_0_0_it(self, render_mock):
"""Should use whatsnew-fx104-default template for it locale"""
req = self.rf.get("/firefox/whatsnew/")
req.locale = "it"
self.view(req, version="104.0")
template = render_mock.call_args[0][1]
assert template == ["firefox/whatsnew/whatsnew-fx104-default.html"]

def test_fx_104_0_0_other_locales(self, render_mock):
"""Should use default whatsnew template for other locales"""
req = self.rf.get("/firefox/whatsnew/")
req.locale = "pt-BR"
self.view(req, version="104.0")
template = render_mock.call_args[0][1]
assert template == ["firefox/whatsnew/index.html"]

# end 104.0 whatsnew tests


@patch("bedrock.firefox.views.l10n_utils.render", return_value=HttpResponse())
class TestFirstRun(TestCase):
Expand Down
6 changes: 6 additions & 0 deletions bedrock/firefox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ class WhatsnewView(L10nTemplateView):
"firefox/whatsnew/whatsnew-fx103-gb.html": ["firefox/whatsnew/whatsnew"],
"firefox/whatsnew/whatsnew-fx103-en.html": ["firefox/whatsnew/whatsnew"],
"firefox/whatsnew/whatsnew-fx103-en-rally.html": ["firefox/whatsnew/whatsnew"],
"firefox/whatsnew/whatsnew-fx104-default.html": ["firefox/whatsnew/whatsnew-104-default", "firefox/whatsnew/whatsnew"],
}

# specific templates that should not be rendered in
Expand Down Expand Up @@ -622,6 +623,11 @@ def get_template_names(self):
template = "firefox/developer/whatsnew.html"
else:
template = "firefox/whatsnew/index.html"
elif version.startswith("104."):
if locale in ["es-ES", "it", "pl"] and ftl_file_is_active("firefox/whatsnew/whatsnew-104-default"):
template = "firefox/whatsnew/whatsnew-fx104-default.html"
else:
template = "firefox/whatsnew/index.html"
elif version.startswith("103."):
if locale == "de":
template = "firefox/whatsnew/whatsnew-fx103-de.html"
Expand Down
8 changes: 8 additions & 0 deletions l10n/configs/pontoon.toml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ locales = [
"nl",
"sv-SE",
]
[[paths]]
reference = "en/firefox/whatsnew/whatsnew-104-default.ftl"
l10n = "{locale}/firefox/whatsnew/whatsnew-104-default.ftl"
locales = [
"es-ES",
"it",
"pl",
]
[[paths]]
reference = "en/firefox/whatsnew/whatsnew-developer-mdnplus.ftl"
l10n = "{locale}/firefox/whatsnew/whatsnew-developer-mdnplus.ftl"
Expand Down
12 changes: 12 additions & 0 deletions l10n/en/firefox/whatsnew/whatsnew-104-default.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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/.

### URL: https://www-dev.allizom.org/firefox/104.0/whatsnew/

whatsnew-104-default-title = Feel safe every time you explore the web
whatsnew-104-default-body = { -brand-name-firefox } is rolling out its strongest privacy protection to date: Total Cookie Protection confines cookies to the sites where they originated, preventing tracking companies from using them to follow you as you browse from site to site. { -brand-name-firefox } will always advocate and innovate for your privacy.
whatsnew-104-default-cta = Make { -brand-name-firefox } your default browser
# "You're all set" means everything is ready, you don't need to do anything more.
whatsnew-104-default-all-set = You’re all set with { -brand-name-firefox } as your default browser.
83 changes: 83 additions & 0 deletions media/css/firefox/whatsnew/whatsnew-104-default.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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/.

$font-path: '/media/protocol/fonts';
$image-path: '/media/protocol/img';

@import '~@mozilla-protocol/core/protocol/css/components/notification-bar';
@import '~@mozilla-protocol/core/protocol/css/includes/lib';
@import 'includes/base';
@import 'includes/dark-mode';

// * -------------------------------------------------------------------------- */
// Main content
.wnp-content-main {
padding-top: $spacing-md;
text-align: center;
}

.wnp-main-title {
@include text-title-xl;
}

.wnp-main-img {
max-width: $content-md;
margin: $spacing-xl auto;

svg {
width: 100%;
height: auto;
}
}

.wnp-main-tagline {
@include text-body-lg;
text-align: left;
}

.wnp-main-cta {
margin-top: $spacing-xl;

&.hide {
display: none;
}

.mzp-c-button {
@include text-body-lg;
}
}

.wnp-alt-msg {
@include text-body-lg;
display: none;
margin-top: $spacing-xl;

&.show {
display: block;
}

@media #{$mq-md} {
strong {
display: inline-block;

&::after {
content: '';
background-image: url('/media/img/firefox/whatsnew/whatsnew104/orange-check.svg');
background-repeat: no-repeat;
height: 25px;
width: 25px;
display: inline-block;
margin: 0 0 -6px 6px;
}
}
}
}

// * -------------------------------------------------------------------------- */
// For dark mode
@media (prefers-color-scheme: dark) {
.wnp-main-title {
color: get-theme('title-text-color-inverse');
}
}
1 change: 1 addition & 0 deletions media/img/firefox/whatsnew/whatsnew104/orange-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions media/js/firefox/whatsnew/whatsnew-104-default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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/.
*/

function isDefaultBrowser() {
'use strict';
return new window.Promise(function (resolve, reject) {
window.Mozilla.UITour.getConfiguration('appinfo', function (details) {
if (details.defaultBrowser) {
resolve();
} else {
reject();
}
});
});
}

function init() {
'use strict';

isDefaultBrowser()
.then(function () {
document.querySelector('.wnp-main-cta').classList.add('hide');
document.querySelector('.wnp-alt-msg').classList.add('show');

window.dataLayer.push({
event: 'non-interaction',
eAction: 'whatsnew-104',
eLabel: 'firefox-default'
});
})
.catch(function () {
window.dataLayer.push({
event: 'non-interaction',
eAction: 'whatsnew-104',
eLabel: 'firefox-not-default'
});
});
}

if (
typeof window.Mozilla.Client !== 'undefined' &&
typeof window.Mozilla.UITour !== 'undefined' &&
window.Mozilla.Client.isFirefoxDesktop
) {
init();
}
12 changes: 12 additions & 0 deletions media/static-bundles.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,12 @@
],
"name": "firefox_whatsnew_103_en_rally"
},
{
"files": [
"css/firefox/whatsnew/whatsnew-104-default.scss"
],
"name": "firefox_whatsnew_104_default"
},
{
"files": [
"css/firefox/privacy/common.scss"
Expand Down Expand Up @@ -1614,6 +1620,12 @@
],
"name": "firefox_whatsnew_103"
},
{
"files": [
"js/firefox/whatsnew/whatsnew-104-default.js"
],
"name": "firefox_whatsnew_104_default"
},
{
"files": [
"js/firefox/privacy/products.js"
Expand Down

0 comments on commit b770177

Please sign in to comment.