start purchase after login when you click the purchase button (bug 827943)

This commit is contained in:
Matt Claypotch 2013-01-18 16:02:24 -08:00
Родитель d77a096138
Коммит 0a808f581d
2 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -21,7 +21,7 @@ define('install', ['capabilities', 'payments'], function(caps, payments) {
function startInstall(product) { function startInstall(product) {
if (z.anonymous && (!z.allowAnonInstalls || product.price)) { if (z.anonymous && (!z.allowAnonInstalls || product.price)) {
localStorage.setItem('toInstall', product.manifest_url); localStorage.setItem('toInstall', product.manifest_url);
$(window).trigger('login'); $(window).trigger('login', true);
return; return;
} }
// Show "Install" button if I'm installing from the Reviewer Tools, // Show "Install" button if I'm installing from the Reviewer Tools,
@ -96,7 +96,7 @@ define('install', ['capabilities', 'payments'], function(caps, payments) {
if (localStorage.getItem('toInstall')) { if (localStorage.getItem('toInstall')) {
var lsVal = localStorage.getItem('toInstall'); var lsVal = localStorage.getItem('toInstall');
localStorage.removeItem('toInstall'); localStorage.removeItem('toInstall');
var product = $(format('.button[data-manifest_url="{0}"]', var product = $(format('.product[data-manifest_url="{0}"]',
lsVal)).data('product'); lsVal)).data('product');
if (product) { if (product) {
startInstall(product); startInstall(product);

Просмотреть файл

@ -2,11 +2,23 @@ define('login', ['notification'], function(notification) {
var requestedLogin = false; var requestedLogin = false;
$(window).bind('login', function() { $(window).bind('login', function(skipDialog) {
$('#login').addClass('show'); if (skipDialog) {
startLogin();
} else {
$('#login').addClass('show');
}
}).on('click', '.browserid', function(e) { }).on('click', '.browserid', function(e) {
var $this = $(this); var $this = $(this);
$this.addClass('loading-submit'); $this.addClass('loading-submit');
z.win.on('logincancel', function() {
$this.removeClass('loading-submit').blur();
})
startLogin();
e.preventDefault();
});
function startLogin() {
requestedLogin = true; requestedLogin = true;
navigator.id.request({ navigator.id.request({
forceIssuer: z.body.data('persona-unverified-issuer') || null, forceIssuer: z.body.data('persona-unverified-issuer') || null,
@ -14,11 +26,11 @@ define('login', ['notification'], function(notification) {
termsOfService: '/terms-of-use', termsOfService: '/terms-of-use',
privacyPolicy: '/privacy-policy', privacyPolicy: '/privacy-policy',
oncancel: function() { oncancel: function() {
$this.removeClass('loading-submit').blur(); z.win.trigger('logincancel');
} }
}); });
e.preventDefault(); }
});
z.body.on('click', '.logout', function() { z.body.on('click', '.logout', function() {
// NOTE: Real logout operations happen on the action of the Logout // NOTE: Real logout operations happen on the action of the Logout
// link/button. This just tells Persona to clean up its data. // link/button. This just tells Persona to clean up its data.