diff --git a/customize.dist/main.js b/customize.dist/main.js index b6149b8ef..a55bd7b44 100644 --- a/customize.dist/main.js +++ b/customize.dist/main.js @@ -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 */ diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 166ed2098..64b40f553 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -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 les conditions d'utilisation"; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index f5b30aadf..86ff53c14 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -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: {}, }; diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index d4e5931f1..af188f0e8 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -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; }; diff --git a/www/settings/main.js b/www/settings/main.js index d02825fc1..3f0ab0331 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -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();