take api settings into account for upgrade button

pull/1/head
ansuz 8 years ago
parent ebfa228bc0
commit daf112a5b5

@ -1,7 +1,8 @@
define([ define([
'jquery', 'jquery',
'/customize/application_config.js', '/customize/application_config.js',
'/common/cryptpad-common.js' '/common/cryptpad-common.js',
'/api/config',
], function ($, Config, Cryptpad, ApiConfig) { ], function ($, Config, Cryptpad, ApiConfig) {
window.APP = { window.APP = {
@ -21,6 +22,13 @@ define([
var $upgrade = $('#upgrade'); 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 // User admin menu
var $userMenu = $('#user-menu'); var $userMenu = $('#user-menu');
var userMenuCfg = { var userMenuCfg = {
@ -58,17 +66,13 @@ define([
}); });
}); });
if (!localStorage.plan) { showUpgrade(Messages.upgradeAccount);
$upgrade.show().text(Messages.upgradeAccount);
}
$loggedInBlock.removeClass('hidden'); $loggedInBlock.removeClass('hidden');
//return;
} else { } else {
$main.find('#userForm').removeClass('hidden'); $main.find('#userForm').removeClass('hidden');
$('#name').focus(); $('#name').focus();
$upgrade.show().text(Messages.supportCryptpad); showUpgrade(Messages.supportCryptpad);
} }
var displayCreateButtons = function () { var displayCreateButtons = function () {

@ -3,8 +3,9 @@ define([
'/common/cryptpad-common.js', '/common/cryptpad-common.js',
'/common/cryptget.js', '/common/cryptget.js',
'/common/mergeDrive.js', '/common/mergeDrive.js',
'/bower_components/file-saver/FileSaver.min.js' '/api/config',
], function ($, Cryptpad, Crypt, Merge) { '/bower_components/file-saver/FileSaver.min.js',
], function ($, Cryptpad, Crypt, Merge, ApiConfig) {
var saveAs = window.saveAs; var saveAs = window.saveAs;
var USERNAME_KEY = 'cryptpad.username'; var USERNAME_KEY = 'cryptpad.username';
@ -15,6 +16,12 @@ define([
}; };
var $upgrade = $('#upgrade'); 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; var Messages = Cryptpad.Messages;
@ -329,11 +336,9 @@ define([
if (Cryptpad.isLoggedIn()) { if (Cryptpad.isLoggedIn()) {
if (!Cryptpad.account.plan) { showUpgrade(Messages.upgradeAccount);
$upgrade.text(Messages.upgradeAccount).show();
}
} else { } else {
$upgrade.text(Messages.supportCryptpad).show(); showUpgrade(Messages.supportCryptpad);
} }
}; };

Loading…
Cancel
Save