update upgrade button logic
This commit is contained in:
parent
f1a9002417
commit
c4e5741ae0
@ -827,20 +827,40 @@ define([
|
|||||||
var width = Math.floor(Math.min(quota, 1)*200); // the bar is 200px width
|
var width = Math.floor(Math.min(quota, 1)*200); // the bar is 200px width
|
||||||
var $usage = $('<span>', {'class': 'usage'}).css('width', width+'px');
|
var $usage = $('<span>', {'class': 'usage'}).css('width', width+'px');
|
||||||
|
|
||||||
if (Config.noSubscriptionButton !== true &&
|
var makeDonateButton = function () {
|
||||||
(quota >= 0.8 || alwaysDisplayUpgrade) &&
|
|
||||||
data.plan !== "power")
|
|
||||||
{
|
|
||||||
// TODO show donate url if applicable
|
|
||||||
var $upgradeLink = $('<a>', {
|
var $upgradeLink = $('<a>', {
|
||||||
href: common.upgradeLink,
|
href: common.donateURL,
|
||||||
|
rel: "noreferrer noopener",
|
||||||
|
target: "_blank",
|
||||||
|
}).appendTo($container);
|
||||||
|
$('<button>', {
|
||||||
|
'class': 'upgrade buttonSuccess',
|
||||||
|
}).text(Messages.supportCryptpad).appendTo($upgradeLink);
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeUpgradeButton = function () {
|
||||||
|
var $upgradeLink = $('<a>', {
|
||||||
|
href: common.upgradeURL,
|
||||||
rel: "noreferrer noopener",
|
rel: "noreferrer noopener",
|
||||||
target: "_blank",
|
target: "_blank",
|
||||||
}).appendTo($container);
|
}).appendTo($container);
|
||||||
$('<button>', {
|
$('<button>', {
|
||||||
'class': 'upgrade buttonSuccess',
|
'class': 'upgrade buttonSuccess',
|
||||||
title: Messages.upgradeTitle
|
title: Messages.upgradeTitle
|
||||||
}).text(Messages.upgrade).appendTo($upgradeLink);
|
}).text(Messages.upgradeAccount).appendTo($upgradeLink);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!Config.removeDonateButton) {
|
||||||
|
if (!common.isLoggedIn() || !Config.allowSubscriptions) {
|
||||||
|
// user is not logged in, or subscriptions are disallowed
|
||||||
|
makeDonateButton();
|
||||||
|
} else if (!common.account.plan) {
|
||||||
|
// user is logged in and subscriptions are allowed
|
||||||
|
// and they don't have one. show upgrades
|
||||||
|
makeUpgradeButton();
|
||||||
|
} else {
|
||||||
|
// they have a plan. show nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var prettyUsage;
|
var prettyUsage;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user