Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
newsletter signup with privacy link (bug 874932)
Browse files Browse the repository at this point in the history
  • Loading branch information
spasovski committed Jun 28, 2013
1 parent d5ebe69 commit ecb9b9d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
31 changes: 20 additions & 11 deletions hearth/media/css/site.styl
Expand Up @@ -177,14 +177,13 @@ body {
}
}

.newssignup {
border-bottom: 1px dashed $london-fog-gray;
diagonal-lines();
min-height: 90px;
.newsletter {
background: #4d4d4d;
min-height: 100px;
position: relative;
&.loading {
background-color: rgba(255,255,255,.7);
min-height: 90px;
//background-color: rgba(255,255,255,.7);
min-height: 100px;
* {
display: none;
}
Expand All @@ -199,7 +198,11 @@ body {
}
}
p {
color: rgb(95,95,95);
color: #c7c7c7;
font-size: 13px;
&:last-child {
margin-top: 11px;
}
}
.processing, .finished {
display: none;
Expand All @@ -210,6 +213,7 @@ body {
width: 285px;
}
&.done {
margin-top: -11px;
* {
display: none;
}
Expand All @@ -231,7 +235,9 @@ body {
display: none;
}
h3 {
overflow: visible;
color: #c7c7c7;
ellipsis();
max-width: 100%;
position: static;
}
}
Expand All @@ -242,19 +248,22 @@ body {
}
input[type=email] {
color: rgb(95,95,95);
height: 27px;
margin-right: 10px;
}
button {
height: 32px;
height: 27px;
line-height: 26px;
min-width: inherit;
}
.btn-side-cancel {
background-position: right center;
border-left: 2px solid #bbb;
border-left: 1px solid #5f5f5f;
float: right;
height: 60px;
height: 75px;
margin-top: 15px;
width: 30px;
right: 0;
}
}

Expand Down
14 changes: 7 additions & 7 deletions hearth/media/js/newssignup.js → hearth/media/js/newsletter.js
@@ -1,4 +1,4 @@
define('newssignup',
define('newsletter',
['capabilities', 'l10n', 'notification', 'requests',
'storage', 'templates', 'underscore', 'urls', 'user', 'utils', 'z'],
function(caps, l10n, n, requests, storage, nunjucks, _, urls, user, utils, z) {
Expand All @@ -14,7 +14,7 @@ define('newssignup',
function init() {
// Toggle the conditions below if you want to test on Desktop.
//if (!user.logged_in()) return;
if (true || !user.logged_in() || !caps.firefoxOS || langs.indexOf(navigator.language) == -1) return;
if (!user.logged_in() || !caps.firefoxOS || langs.indexOf(navigator.language) == -1) return;

var counter = +storage.getItem('newscounter');
if (counter == 4) return;
Expand All @@ -26,7 +26,7 @@ define('newssignup',
// Counter expires in 72 hours.
if (storedTime) {
storedTime = new Date(+storedTime);
expired = (now - storedTime) > 4320000; // 72 hours
expired = (now - storedTime) > 259200000; // 72 hours (1000 x 60 x 60 x 72)
}

// Increment counter if not expired otherwise save the time and set to 1.
Expand All @@ -47,7 +47,7 @@ define('newssignup',
// Handle newsletter signup form submit.
z.body.on('submit', '.news-signup-form', function(e) {
e.preventDefault();
var $signup = z.page.find('.newssignup');
var $signup = $('main').find('.newsletter');

var $this = $(this);
var data = utils.getVars($this.serialize());
Expand All @@ -65,11 +65,11 @@ define('newssignup',

function injectSignupForm() {
var $signup;
z.page.prepend(
nunjucks.env.getTemplate('user/newssignup.html').render({email: user.get_setting('email')})
$('main').prepend(
nunjucks.env.getTemplate('user/newsletter.html').render({email: user.get_setting('email')})
);

$signup = z.page.find('.newssignup');
$signup = $('.newsletter');

$signup.find('.close').on('click', utils._pd(function(e) {
$signup.hide();
Expand Down
6 changes: 3 additions & 3 deletions hearth/media/js/views/homepage.js
@@ -1,6 +1,6 @@
define('views/homepage',
['l10n', 'newssignup', 'underscore', 'urls'],
function(l10n, newssignup, _, urls) {
['l10n', 'newsletter', 'underscore', 'urls'],
function(l10n, newsletter, _, urls) {
'use strict';

var gettext = l10n.gettext;
Expand All @@ -25,6 +25,6 @@ define('views/homepage',
endpoint: urls.api.url('category', [''], params),
category_name: gettext('All Categories'),
sort: params.sort
}).done(newssignup.init);
}).done(newsletter.init);
};
});
@@ -1,4 +1,4 @@
<div class="newssignup c">
<div class="newsletter c">
<div>
<header class="secondary-header">
<h3>{{ _('Get Firefox Marketplace news') }}</h3>
Expand All @@ -8,11 +8,12 @@ <h3>{{ _('Get Firefox Marketplace news') }}</h3>
<input type="email" id="email" name="email" value="{{ email }}">
<button class="button" type="submit">{{ _('Sign up') }}</button>
</p>
<p><a href="{{ url('privacy') }}">{{ _('Privacy Policy') }}</a></p>
</form>
</div>
<a href="#" class="btn-side-cancel close">{{ _('Cancel') }}</a>
<p class="processing">
<span class="spinner alt"></span>{{ _('Signing up...') }}
<span class="spinner"></span>{{ _('Signing up...') }}
</p>
<p class="finished">
{{ _('You were successfully signed up for the Marketplace newsletter!') }}
Expand Down

0 comments on commit ecb9b9d

Please sign in to comment.