Skip to content

Commit

Permalink
Review Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lesleyjanenorton committed Nov 2, 2018
1 parent 16788f4 commit 5d2245b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 27 deletions.
34 changes: 24 additions & 10 deletions controllers/email-l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,57 @@
const HBSHelpers = require("../hbs-helpers");


function testEmails(req, res) {
function getEmailMockUps(req, res) {
const unsafeBreachesForEmail = [];
const email = "example@email.com";
let breachAlert;
let buttonValue = req.fluentFormat("verify-my-email");

if (!req.query.view) {
req.query.view = "email_verify";
if (!req.query.partial) {
req.query.partial = "email_verify";
} else if (req.query.partial !== "report") {
res.redirect("/email-l10n");
}

if (req.query.type) {
const emailType = req.query.type;

if (["breachAlert", "singleBreach", "multipleBreaches", "noBreaches"].indexOf(emailType) === -1) {
res.redirect("/email-l10n");
}

buttonValue = req.fluentFormat("report-scan-another-email");
if(req.query.type === "singleBreach" || req.query.type === "breachAlert") {
if(emailType === "singleBreach" || emailType === "breachAlert") {
unsafeBreachesForEmail.push(req.app.locals.breaches.filter(breach => breach.Name === "Experian")[0]);
if(req.query.type === "breachAlert") {
if(emailType === "breachAlert") {
breachAlert = unsafeBreachesForEmail[0];
}
} else if (req.query.type === "multipleBreaches") {
} else if (emailType === "multipleBreaches") {
const breachArray = ["Experian", "Dropbox", "Apollo"];
breachArray.forEach(name => {
unsafeBreachesForEmail.push(req.app.locals.breaches.filter(breach => breach.Name === name)[0]);
});
}
}

res.render("test_emails", {
layout: "email_l10n_testing.hbs",
res.render("email_l10n", {
layout: "email_l10n_mockups.hbs",
unsafeBreachesForEmail: unsafeBreachesForEmail,
supportedLocales: req.supportedLocales,
whichView: `email_partials/${req.query.view}`,
whichPartial: `email_partials/${req.query.partial}`,
date: HBSHelpers.prettyDate(req.supportedLocales, new Date()),
buttonValue,
breachAlert,
email,
});
}

function notFound(req, res) {
res.status(404);
res.redirect("/email-l10n");
}

module.exports = {
testEmails,
getEmailMockUps,
notFound,
};
16 changes: 8 additions & 8 deletions public/css/email_l10n_testing.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
body.email-locale-testing {
background: #ededf0;
background-color: #ededf0;
background: rgb(237, 237, 240);
background-color: rgb(237, 237, 240);
background-image: none;
color: rgba(12, 12, 13, 0.7);
}
Expand All @@ -20,7 +20,7 @@ body.email-locale-testing .section-wrapper {
}

.email-locale-testing nav a {
color: #000;
color: rgb(0, 0, 0);
display: block;
font-size: 13px;
margin: 10px 0;
Expand All @@ -35,7 +35,7 @@ body.email-locale-testing .section-wrapper {
.email-content {
overflow: hidden;
border-radius: 3px;
box-shadow: 2px 2px 5px #7788995c;
box-shadow: 2px 2px 5px rgba(119, 136, 153, 0.361);
}

.email-test-wrapper .firefox-logo,
Expand All @@ -44,7 +44,7 @@ body.email-locale-testing .section-wrapper {
}

.email-body {
background: #fff;
background: rgb(255, 255, 255);
min-height: 300px;
display: flex;
flex-direction: column;
Expand All @@ -63,7 +63,7 @@ body.email-locale-testing .section-wrapper {
}

.email-footer a {
color: #0060df;
color: rgb(0, 96, 223);
}

.footer-copy {
Expand All @@ -90,7 +90,7 @@ body.email-locale-testing .section-wrapper {
padding: 10px 30px !important;
display: inline-block;
border-radius: 3px !important;
background-color: #0060df;
background-color: rgb(0, 96, 223);
}

.email-headline-copy {
Expand Down Expand Up @@ -120,7 +120,7 @@ td.logomark-wrapper {
td h1.firefox-logotype {
font-size: 2rem;
font-weight: 400 !important;
color: #fff;
color: rgb(255, 255, 255);
}

table.table-button tr {
Expand Down
6 changes: 3 additions & 3 deletions routes/email-l10n.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";
const express = require("express");
const { testEmails } = require("../controllers/email-l10n");
const { getEmailMockUps, notFound } = require("../controllers/email-l10n");
const router = express.Router();


router.get("/", testEmails);

router.get("/", getEmailMockUps);
router.use(notFound);

module.exports = router;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="/dist/app.min.css">
<link rel="stylesheet" href="/dist/email_l10n_testing.min.css">
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="partialport" content="width=device-width, initial-scale=1.0, partialport-fit=cover" />
<title>Firefox Monitor: Email L10n</title>
<script type="text/javascript" src="/dist/app.min.js" defer></script>

Expand All @@ -22,7 +22,7 @@
{{> email_partials/email_logo}}

<section class="email-body">
{{> (lookup . 'whichView')}}
{{> (lookup . 'whichPartial')}}
</section>
</div><!--email-content-->
<section class="email-footer">
Expand All @@ -31,10 +31,10 @@
</section>
<nav>
<a href="/email-l10n">Verification Email</a>
<a href="/email-l10n/?view=report&type=singleBreach">Report with Single Breach</a>
<a href="/email-l10n/?view=report&type=multipleBreaches">Report with Multiple Breaches</a>
<a href="/email-l10n/?view=report&type=noBreaches">Report with No Breaches</a>
<a href="/email-l10n/?view=report&type=breachAlert">Breach Alert</a>
<a href="/email-l10n/?partial=report&type=singleBreach">Report with Single Breach</a>
<a href="/email-l10n/?partial=report&type=multipleBreaches">Report with Multiple Breaches</a>
<a href="/email-l10n/?partial=report&type=noBreaches">Report with No Breaches</a>
<a href="/email-l10n/?partial=report&type=breachAlert">Breach Alert</a>
</nav>
</section>
</body>
Expand Down

0 comments on commit 5d2245b

Please sign in to comment.