Add OpenCollective links

pull/1/head
yflory 6 years ago
parent d2c1ed5eff
commit 716159d300

@ -615,6 +615,19 @@ define([
} }
]); ]);
var crowdFunding = h('button', [
Msg.crowdfunding_home1,
h('br'),
Msg.crowdfunding_home2
]);
$(crowdFunding).click(function () {
var a = document.createElement("a");
a.href = "https://opencollective.com/cryptpad/contribute";
a.target = "_blank";
a.rel = "noopener";
a.click();
});
return [ return [
h('div#cp-main', [ h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
@ -629,6 +642,11 @@ define([
icons, icons,
more more
]) ])
]),
h('div.row', [
h('div.cp-crowdfunding', [
crowdFunding
])
]) ])
]), ]),
]), ]),

@ -43,6 +43,10 @@
//transform: scale(0.1); //transform: scale(0.1);
//transform: scale(1); //transform: scale(1);
h1, h2, h3 {
font-size: 1.5em;
}
.cp-corner-filler { .cp-corner-filler {
float: left; float: left;
clear: left; clear: left;
@ -94,6 +98,8 @@
.cp-corner-footer { .cp-corner-footer {
font-style: italic; font-style: italic;
font-size: 0.8em; font-size: 0.8em;
}
.cp-corner-footer, .cp-corner-text {
a { a {
color: @corner-link; color: @corner-link;
&:hover { &:hover {
@ -103,10 +109,10 @@
} }
button { button {
color: white;
border: 0px; border: 0px;
padding: 5px; padding: 5px;
color: @colortheme_base; color: @colortheme_base;
margin-left: 5px;
&.cp-corner-primary { &.cp-corner-primary {
background-color: @corner-button-ok; background-color: @corner-button-ok;
font-weight: bold; font-weight: bold;

@ -180,6 +180,24 @@
} }
} }
} }
.cp-crowdfunding {
width: 100%;
text-align: center;
button {
outline: none;
background-color: @colortheme_logo-2;
color: @colortheme_base;
border: none;
padding: 10px 20px;
border-radius: 44px;
cursor: pointer;
&:hover {
background-color: lighten(@colortheme_logo-2, 3%);
}
}
}
@media (min-width: 576px) and (max-width: 767px) { @media (min-width: 576px) and (max-width: 767px) {
.container { .container {
padding-left: 0; padding-left: 0;

@ -1264,5 +1264,16 @@ define(function () {
out.autostore_forceSave = "Store the file in your CryptDrive"; // File upload modal out.autostore_forceSave = "Store the file in your CryptDrive"; // File upload modal
out.autostore_notAvailable = "You must store this pad in your CryptDrive before being able to use this feature."; // Properties/tags/move to trash out.autostore_notAvailable = "You must store this pad in your CryptDrive before being able to use this feature."; // Properties/tags/move to trash
// Crowdfunding messages
out.crowdfunding_home1 = "CryptPad needs your help!";
out.crowdfunding_home2 = "Click to learn about our crowdfunding campaign.";
out.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>';
out.crowdfunding_popup_yes = "Go to OpenCollective";
out.crowdfunding_popup_no = "Not now";
out.crowdfunding_popup_never = "Don't ask me again";
return out; return out;
}); });

@ -892,7 +892,7 @@ define([
h('div.cp-corner-filler', { style: "width:60px;" }), h('div.cp-corner-filler', { style: "width:60px;" }),
h('div.cp-corner-filler', { style: "width:40px;" }), h('div.cp-corner-filler', { style: "width:40px;" }),
h('div.cp-corner-filler', { style: "width:20px;" }), h('div.cp-corner-filler', { style: "width:20px;" }),
h('div.cp-corner-text', text), Pages.setHTML(h('div.cp-corner-text'), text),
h('div.cp-corner-actions', actions), h('div.cp-corner-actions', actions),
Pages.setHTML(h('div.cp-corner-footer'), footer) Pages.setHTML(h('div.cp-corner-footer'), footer)
]); ]);

@ -12,10 +12,11 @@ define([
'/common/clipboard.js', '/common/clipboard.js',
'/customize/messages.js', '/customize/messages.js',
'/customize/application_config.js', '/customize/application_config.js',
'/customize/pages.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'css!/customize/fonts/cptools/style.css' 'css!/customize/fonts/cptools/style.css'
], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Clipboard, ], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Clipboard,
Messages, AppConfig, NThen) { Messages, AppConfig, Pages, NThen) {
var UIElements = {}; var UIElements = {};
// Configure MediaTags to use our local viewer // Configure MediaTags to use our local viewer
@ -2325,6 +2326,44 @@ define([
$(password).find('.cp-password-input').focus(); $(password).find('.cp-password-input').focus();
}; };
var crowdfundingState = false;
UIElements.displayCrowdfunding = function (common) {
if (crowdfundingState) { return; }
crowdfundingState = true;
setTimeout(function () {
common.getAttribute(['general', 'crowdfunding'], function (err, val) {
if (err || val === false) { return; }
// Display the popup
var text = Messages.crowdfunding_popup_text;
var yes = h('button.cp-corner-primary', Messages.crowdfunding_popup_yes);
var no = h('button.cp-corner-primary', Messages.crowdfunding_popup_no);
var never = h('button.cp-corner-cancel', Messages.crowdfunding_popup_never);
var actions = h('div', [yes, no, never]);
var modal = UI.cornerPopup(text, actions, null, {big: true});
$(yes).click(function () {
modal.delete();
common.openURL('https://opencollective.com/cryptpad/contribute');
});
$(modal.popup).find('a').click(function (e) {
e.stopPropagation();
e.preventDefault();
modal.delete();
common.openURL('https://opencollective.com/cryptpad/');
});
$(no).click(function () {
modal.delete();
});
$(never).click(function () {
modal.delete();
common.setAttribute(['general', 'crowdfunding'], false);
});
});
}, 5000);
};
var storePopupState = false; var storePopupState = false;
UIElements.displayStorePadPopup = function (common, data) { UIElements.displayStorePadPopup = function (common, data) {
if (storePopupState) { return; } if (storePopupState) { return; }
@ -2347,9 +2386,11 @@ define([
}); });
$(hide).click(function () { $(hide).click(function () {
UIElements.displayCrowdfunding(common);
modal.delete(); modal.delete();
}); });
$(store).click(function () { $(store).click(function () {
UIElements.displayCrowdfunding(common);
modal.delete(); modal.delete();
common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) { common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) {
if (err || (obj && obj.error)) { if (err || (obj && obj.error)) {

@ -535,6 +535,11 @@ define([
UI.alert(Messages.chrome68); UI.alert(Messages.chrome68);
}); });
funcs.isPadStored(function (err, val) {
if (err || !val) { return; }
UIElements.displayCrowdfunding(funcs);
});
ctx.sframeChan.ready(); ctx.sframeChan.ready();
cb(funcs); cb(funcs);
}); });

Loading…
Cancel
Save