-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
…262, bug 710062, bug 744432)
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ label.choice { | |
.errorlist, | ||
.error, | ||
.error label { | ||
color: @red !important; | ||
color: @red; | ||
} | ||
|
||
.error { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,54 @@ | ||
// This page intentionally left blank. | ||
(function() { | ||
function getButton(product) { | ||
// Look up button by its manifest URL. | ||
return $button = $(format('.button[data-manifestUrl="{0}"]', | ||
product.manifestUrl)); | ||
} | ||
|
||
function setButton($button, text, cls) { | ||
if (cls == 'purchasing' || cls == 'installing') { | ||
// Save the old text of the button if we know we may revert later. | ||
$button.data('old-text', $button.html()); | ||
} | ||
$button.html(text); | ||
if (cls == 'purchasing' || cls == 'installing') { | ||
// The text has changed, so do another linefit. | ||
$button.css('font-size', 14).linefit(); | ||
} else { | ||
$button.removeClass('purchasing installing'); | ||
} | ||
$button.addClass(cls); | ||
} | ||
|
||
function revertButton($button) { | ||
// Cancelled install/purchase. Roll back button to its previous state. | ||
$button.html($button.data('old-text')) | ||
.removeClass('purchasing'); | ||
// The text has changed, so do another linefit. | ||
$button.css('font-size', 14).linefit(); | ||
} | ||
|
||
$(window).bind('app_purchase_start', function(e, product) { | ||
setButton(getButton(product), gettext('Purchasing…'), 'purchasing'); | ||
}).bind('app_purchase_success', function(e, product) { | ||
setButton(getButton(product), gettext('Purchased'), 'purchased'); | ||
}).bind('app_install_start', function(e, product) { | ||
var $button = getButton(product); | ||
setButton(getButton(product), gettext('Installing…'), 'installing'); | ||
}).bind('app_install_success', function(e, product) { | ||
setButton(getButton(product), gettext('Installed'), 'installed'); | ||
}).bind('app_purchase_error app_install_error', function(e, product, msg) { | ||
var $button = getButton(product); | ||
if (msg) { | ||
setButton($button, gettext('Error'), 'error'); | ||
alert(msg); | ||
} else { | ||
// Cancelled install. Roll back. | ||
revertButton($button); | ||
} | ||
}); | ||
})(); | ||
|
||
|
||
// Shrink text in buttons so everything fits on one line. | ||
$('.button').linefit(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,18 +32,17 @@ def market_button(context, product): | |
label = price_label(product) | ||
product_dict = product_as_dict(request, product) | ||
data_attrs = { | ||
'product': json.dumps(product_dict, cls=JSONEncoder) | ||
'product': json.dumps(product_dict, cls=JSONEncoder), | ||
'manifestUrl': product.manifest_url, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cvan
Author
Contributor
|
||
} | ||
if product.is_premium() and product.premium: | ||
classes.append('premium') | ||
data_attrs.update({ | ||
'purchase': product.get_purchase_url() + '?', | ||
#'start-purchase': product.get_detail_url('purchase.start'), | ||
'cost': product.premium.get_price(), | ||
}) | ||
if not product.is_premium() or product.has_purchased(request.amo_user): | ||
if not product.is_premium(): | ||
classes.append('install') | ||
label = _('Install') | ||
elif product.has_purchased(request.amo_user): | ||
classes.append('install purchased') | ||
label = _('Purchased') | ||
This comment has been minimized.
Sorry, something went wrong.
andymckay
Contributor
|
||
# TODO: Show inline BroswerID login popup for non-authenticated users. | ||
c = dict(product=product, label=label, | ||
data_attrs=data_attrs, classes=' '.join(classes)) | ||
|
Isn't that in the product dump as well? https://github.com/mozilla/zamboni/blob/master/mkt/site/helpers.py#L57