Fix the upgrade and donate buttons in the home page

pull/1/head
yflory 8 years ago
parent ee57458158
commit ac91d2f413

@ -3,6 +3,7 @@ define([
'/customize/application_config.js',
'/common/cryptpad-common.js',
'/api/config',
'/customize/header.js',
], function ($, Config, Cryptpad, ApiConfig) {
window.APP = {
@ -14,29 +15,6 @@ define([
$(function () {
var $main = $('#mainBlock');
// Language selector
var $sel = $('#language-selector');
Cryptpad.createLanguageSelector(undefined, $sel);
$sel.find('button').addClass('btn').addClass('btn-secondary');
$sel.show();
var $upgrade = $('#upgrade');
var showUpgrade = function (text) {
if (ApiConfig.removeDonateButton) { return; }
if (localStorage.plan) { return; }
if (!text) { return; }
$upgrade.text(text).show();
};
// User admin menu
var $userMenu = $('#user-menu');
var userMenuCfg = {
$initBlock: $userMenu
};
var $userAdmin = Cryptpad.createUserAdminMenu(userMenuCfg);
$userAdmin.find('button').addClass('btn').addClass('btn-secondary');
$(window).click(function () {
$('.cryptpad-dropdown').hide();
});
@ -66,13 +44,11 @@ define([
});
});
showUpgrade(Messages.upgradeAccount);
$loggedInBlock.removeClass('hidden');
} else {
}
else {
$main.find('#userForm').removeClass('hidden');
$('#name').focus();
showUpgrade(Messages.supportCryptpad);
}
var displayCreateButtons = function () {
@ -99,7 +75,6 @@ define([
var $block = Cryptpad.createDropdown(dropdownConfig);
$block.find('button').addClass('btn').addClass('btn-primary');
$block.appendTo($parent);
};
/* Log in UI */

@ -308,7 +308,7 @@ define(function () {
out.login_invalPass = 'Mot de passe requis';
out.login_unhandledError = "Une erreur inattendue s'est produite :(";
out.login_notRegistered = 'Pas enregistré ?';
out.login_notRegistered = 'Pas encore inscrit ?';
out.register_importRecent = "Importer l'historique (Recommendé)";
out.register_acceptTerms = "J'accepte <a href='/terms.html'>les conditions d'utilisation</a>";

@ -27,6 +27,7 @@ define([
Messages: Messages,
Clipboard: Clipboard,
donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + window.location.hostname,
upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + window.location.hostname,
account: {},
};

@ -703,12 +703,15 @@ define([
var text;
var feedback;
var url;
if (ApiConfig.allowSubscriptions && Cryptpad.isLoggedIn()) {
text = Messages.upgradeAccount;
feedback = "UPGRADE_ACCOUNT";
url = Cryptpad.upgradeURL;
} else {
text = Messages.supportCryptpad;
feedback = "SUPPORT_CRYPTPAD";
url = Cryptpad.donateURL;
}
var $upgrade = toolbar.$top.find('.' + UPGRADE_CLS).attr({
@ -716,7 +719,7 @@ define([
}).text(text).show()
.click(function () {
Cryptpad.feedback(feedback);
window.open(Cryptpad.donateURL,'_blank');
window.open(url,'_blank');
});
return $upgrade;
};

@ -5,6 +5,7 @@ define([
'/common/mergeDrive.js',
'/api/config',
'/bower_components/file-saver/FileSaver.min.js',
'/customize/header.js',
], function ($, Cryptpad, Crypt, Merge, ApiConfig) {
var saveAs = window.saveAs;
@ -15,14 +16,6 @@ define([
_onRefresh: []
};
var $upgrade = $('#upgrade');
var showUpgrade = function (text) {
if (ApiConfig.removeDonateButton) { return; }
if (localStorage.plan) { return; }
if (!text) { return; }
$upgrade.text(text).show();
};
var Messages = Cryptpad.Messages;
// Manage changes in the realtime object made from another page
@ -333,30 +326,10 @@ define([
APP.$container.append(createUserFeedbackToggle(obj));
obj.proxy.on('change', [], refresh);
obj.proxy.on('remove', [], refresh);
if (Cryptpad.isLoggedIn()) {
showUpgrade(Messages.upgradeAccount);
} else {
showUpgrade(Messages.supportCryptpad);
}
};
$(function () {
var $main = $('#mainBlock');
// Language selector
var $sel = $('#language-selector');
Cryptpad.createLanguageSelector(undefined, $sel);
$sel.find('button').addClass('btn').addClass('btn-secondary');
$sel.show();
// User admin menu
var $userMenu = $('#user-menu');
var userMenuCfg = {
$initBlock: $userMenu
};
var $userAdmin = Cryptpad.createUserAdminMenu(userMenuCfg);
$userAdmin.find('button').addClass('btn').addClass('btn-secondary');
$(window).click(function () {
$('.cryptpad-dropdown').hide();

Loading…
Cancel
Save