Add links to the CryptPad survey and to the crowdfunding page

pull/1/head
yflory 5 years ago
parent d5c4285c61
commit 390ca941e7

@ -97,7 +97,7 @@ define([
]);*/ ]);*/
var _link = h('a', { var _link = h('a', {
href: "https://opencollective.com/cryptpad/contribute", href: "https://opencollective.com/cryptpad/",
target: '_blank', target: '_blank',
rel: 'noopener', rel: 'noopener',
}); });

@ -121,6 +121,9 @@
margin: 5px 0px; margin: 5px 0px;
height: 1px; height: 1px;
background: #bbb; background: #bbb;
& + hr {
display: none;
}
} }
p { p {

@ -53,12 +53,22 @@
font-weight: bold; font-weight: bold;
} }
} }
.cp-limit-upgrade { .cp-limit-buttons {
padding: 0; display: flex;
line-height: 25px; flex-wrap: wrap;
justify-content: space-around;
justify-content: space-evenly;
a {
height: 25px; height: 25px;
margin: 0 3px; display: inline-flex;
border-radius: 0; align-items: center;
min-width: 200px;
width: 50%;
padding-top: 0;
padding-bottom: 0;
justify-content: center;
flex: 1;
}
} }
} }
} }

@ -156,5 +156,7 @@ define(function() {
// by default by the CryptPad developers. // by default by the CryptPad developers.
config.disableSharedFolders = false; config.disableSharedFolders = false;
config.surveyURL = "https://survey.cryptpad.fr/index.php/672782";
return config; return config;
}); });

@ -2205,15 +2205,16 @@ define([
var $limit = $('<span>', {'class': 'cp-limit-bar'}).appendTo($container); var $limit = $('<span>', {'class': 'cp-limit-bar'}).appendTo($container);
var quota = usage/limit; var quota = usage/limit;
var $usage = $('<span>', {'class': 'cp-limit-usage'}).css('width', quota*100+'%'); var $usage = $('<span>', {'class': 'cp-limit-usage'}).css('width', quota*100+'%');
var $buttons = $(h('span.cp-limit-buttons')).appendTo($container);
var urls = common.getMetadataMgr().getPrivateData().accounts; var urls = common.getMetadataMgr().getPrivateData().accounts;
var makeDonateButton = function () { var makeDonateButton = function () {
var $a = $('<a>', { var $a = $('<a>', {
'class': 'cp-limit-upgrade btn btn-success', 'class': 'cp-limit-upgrade btn btn-primary',
href: urls.donateURL, href: urls.donateURL,
rel: "noreferrer noopener", rel: "noreferrer noopener",
target: "_blank", target: "_blank",
}).text(Messages.supportCryptpad).appendTo($container); }).text(Messages.crowdfunding_button2).appendTo($buttons);
$a.click(function () { $a.click(function () {
Feedback.send('SUPPORT_CRYPTPAD'); Feedback.send('SUPPORT_CRYPTPAD');
}); });
@ -2225,7 +2226,7 @@ define([
href: urls.upgradeURL, href: urls.upgradeURL,
rel: "noreferrer noopener", rel: "noreferrer noopener",
target: "_blank", target: "_blank",
}).text(Messages.upgradeAccount).appendTo($container); }).text(Messages.upgradeAccount).appendTo($buttons);
$a.click(function () { $a.click(function () {
Feedback.send('UPGRADE_ACCOUNT'); Feedback.send('UPGRADE_ACCOUNT');
}); });
@ -2238,6 +2239,7 @@ define([
} else if (!plan) { } else if (!plan) {
// user is logged in and subscriptions are allowed // user is logged in and subscriptions are allowed
// and they don't have one. show upgrades // and they don't have one. show upgrades
makeDonateButton();
makeUpgradeButton(); makeUpgradeButton();
} else { } else {
// they have a plan. show nothing // they have a plan. show nothing
@ -2548,15 +2550,42 @@ define([
content: h('span', Messages.supportPage || 'Support') content: h('span', Messages.supportPage || 'Support')
}); });
} }
options.push({ tag: 'hr' });
if (Config.allowSubscriptions) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: { attributes: {
'target': '_blank', 'target': '_blank',
'href': origin+'/features.html', 'href': priv.plan ? priv.accounts.upgradeURL : origin+'/features.html',
'class': 'fa fa-star-o' 'class': 'fa fa-star-o'
}, },
content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing) content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing)
}); });
}
if (!priv.plan && !Config.removeDonateButton) {
options.push({
tag: 'a',
attributes: {
'target': '_blank',
'rel': 'noopener',
'href': priv.accounts.donateURL,
'class': 'fa fa-gift'
},
content: h('span', Messages.crowdfunding_button2)
});
}
if (AppConfig.surveyURL) {
options.push({
tag: 'a',
attributes: {
'target': '_blank',
'rel': 'noopener',
'href': AppConfig.surveyURL,
'class': 'fa fa-graduation-cap'
},
content: h('span', Messages.survey)
});
}
options.push({ tag: 'hr' }); options.push({ tag: 'hr' });
// Add login or logout button depending on the current status // Add login or logout button depending on the current status
if (accountName) { if (accountName) {
@ -3440,6 +3469,9 @@ define([
setTimeout(function () { setTimeout(function () {
common.getAttribute(['general', 'crowdfunding'], function (err, val) { common.getAttribute(['general', 'crowdfunding'], function (err, val) {
if (err || val === false) { return; } if (err || val === false) { return; }
common.getSframeChannel().query('Q_GET_PINNED_USAGE', null, function (err, obj) {
var quotaMb = obj.quota / (1024 * 1024);
if (quotaMb < 10) { return; }
// Display the popup // Display the popup
var text = Messages.crowdfunding_popup_text; var text = Messages.crowdfunding_popup_text;
var yes = h('button.cp-corner-primary', Messages.crowdfunding_popup_yes); var yes = h('button.cp-corner-primary', Messages.crowdfunding_popup_yes);
@ -3451,14 +3483,14 @@ define([
$(yes).click(function () { $(yes).click(function () {
modal.delete(); modal.delete();
common.openURL('https://opencollective.com/cryptpad/contribute'); common.openURL(priv.accounts.donateURL);
Feedback.send('CROWDFUNDING_YES'); Feedback.send('CROWDFUNDING_YES');
}); });
$(modal.popup).find('a').click(function (e) { $(modal.popup).find('a').click(function (e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
modal.delete(); modal.delete();
common.openURL('https://opencollective.com/cryptpad/'); common.openURL(priv.accounts.donateURL);
Feedback.send('CROWDFUNDING_LINK'); Feedback.send('CROWDFUNDING_LINK');
}); });
$(no).click(function () { $(no).click(function () {
@ -3470,7 +3502,7 @@ define([
common.setAttribute(['general', 'crowdfunding'], false); common.setAttribute(['general', 'crowdfunding'], false);
Feedback.send('CROWDFUNDING_NEVER'); Feedback.send('CROWDFUNDING_NEVER');
}); });
});
}); });
}, 5000); }, 5000);
}; };

@ -42,7 +42,8 @@ define([
var origin = encodeURIComponent(window.location.hostname); var origin = encodeURIComponent(window.location.hostname);
var common = window.Cryptpad = { var common = window.Cryptpad = {
Messages: Messages, Messages: Messages,
donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + origin, //donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + origin,
donateURL: "https://opencollective.com/cryptpad/",
upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + origin, upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + origin,
account: {}, account: {},
}; };

@ -376,6 +376,14 @@ define([
}); });
}); });
sframeChan.on('Q_GET_PINNED_USAGE', function (data, cb) {
Cryptpad.getPinnedUsage({}, function (e, used) {
cb({
error: e,
quota: used
});
});
});
sframeChan.on('Q_GET_PIN_LIMIT_STATUS', function (data, cb) { sframeChan.on('Q_GET_PIN_LIMIT_STATUS', function (data, cb) {
Cryptpad.isOverPinLimit(null, function (e, overLimit, limits) { Cryptpad.isOverPinLimit(null, function (e, overLimit, limits) {
cb({ cb({

@ -1000,10 +1000,12 @@
"crowdfunding_home1": "CryptPad a besoin d'aide !", "crowdfunding_home1": "CryptPad a besoin d'aide !",
"crowdfunding_home2": "Cliquez sur le bouton pour découvrir notre campagne de financement participatif.", "crowdfunding_home2": "Cliquez sur le bouton pour découvrir notre campagne de financement participatif.",
"crowdfunding_button": "Soutenir CryptPad", "crowdfunding_button": "Soutenir CryptPad",
"crowdfunding_button2": "Aider CryptPad",
"crowdfunding_popup_text": "<h3>Aider CryptPad</h3>Pour vous assurer que CryptPad soit activement développé, nous vous invitons à supporter le projet via la <a href=\"https://opencollective.com/cryptpad\">page OpenCollective</a>, où vous pouvez trouver notre <b>Roadmap</b> et nos <b>objectifs de financement</b>.", "crowdfunding_popup_text": "<h3>Aider CryptPad</h3>Pour vous assurer que CryptPad soit activement développé, nous vous invitons à supporter le projet via la <a href=\"https://opencollective.com/cryptpad\">page OpenCollective</a>, où vous pouvez trouver notre <b>Roadmap</b> et nos <b>objectifs de financement</b>.",
"crowdfunding_popup_yes": "Voir la page", "crowdfunding_popup_yes": "Voir la page",
"crowdfunding_popup_no": "Pas maintenant", "crowdfunding_popup_no": "Pas maintenant",
"crowdfunding_popup_never": "Ne plus demander", "crowdfunding_popup_never": "Ne plus demander",
"survey": "Enquête CryptPad",
"markdown_toc": "Sommaire", "markdown_toc": "Sommaire",
"debug_getGraph": "Obtenir le code permettant de générer un graphe de ce document", "debug_getGraph": "Obtenir le code permettant de générer un graphe de ce document",
"debug_getGraphWait": "Génération du graphe... Veuillez patienter.", "debug_getGraphWait": "Génération du graphe... Veuillez patienter.",

@ -1020,10 +1020,12 @@
"crowdfunding_home1": "CryptPad needs your help!", "crowdfunding_home1": "CryptPad needs your help!",
"crowdfunding_home2": "Click on the button to learn about our crowdfunding campaign.", "crowdfunding_home2": "Click on the button to learn about our crowdfunding campaign.",
"crowdfunding_button": "Support CryptPad", "crowdfunding_button": "Support CryptPad",
"crowdfunding_button2": "Help CryptPad",
"crowdfunding_popup_text": "<h3>We need your help!</h3>To ensure that CryptPad is actively developed, consider supporting the project via the <a href=\"https://opencollective.com/cryptpad\">OpenCollective page</a>, where you can see our <b>Roadmap</b> and <b>Funding goals</b>.", "crowdfunding_popup_text": "<h3>We need your help!</h3>To ensure that CryptPad is actively developed, consider supporting the project via the <a href=\"https://opencollective.com/cryptpad\">OpenCollective page</a>, where you can see our <b>Roadmap</b> and <b>Funding goals</b>.",
"crowdfunding_popup_yes": "Go to OpenCollective", "crowdfunding_popup_yes": "Go to OpenCollective",
"crowdfunding_popup_no": "Not now", "crowdfunding_popup_no": "Not now",
"crowdfunding_popup_never": "Don't ask me again", "crowdfunding_popup_never": "Don't ask me again",
"survey": "CryptPad survey",
"markdown_toc": "Contents", "markdown_toc": "Contents",
"fm_expirablePad": "This pad will expire on {0}", "fm_expirablePad": "This pad will expire on {0}",
"admin_authError": "Only administrators can access this page", "admin_authError": "Only administrators can access this page",

@ -47,7 +47,7 @@
height: 100%; height: 100%;
} }
} }
.cp-limit-upgrade { .cp-limit-buttons {
display: none; display: none;
} }
} }

Loading…
Cancel
Save