From ebfa228bc0c7c91486b429685e992e3e29a48309 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 30 May 2017 18:39:41 +0200 Subject: [PATCH] add upgrade button to all static pages --- customize.dist/about.html | 3 +++ customize.dist/contact.html | 3 +++ customize.dist/index.html | 3 +++ customize.dist/main.css | 16 ++++++++++++++++ customize.dist/main.js | 13 ++++++++++--- customize.dist/privacy.html | 3 +++ customize.dist/src/fragments/topbar.html | 3 +++ customize.dist/src/less/topbar.less | 18 ++++++++++++++++++ customize.dist/terms.html | 3 +++ www/common/cryptpad-common.js | 3 ++- www/settings/index.html | 3 +++ www/settings/main.js | 11 +++++++++++ www/user/index.html | 3 +++ 13 files changed, 81 insertions(+), 4 deletions(-) diff --git a/customize.dist/about.html b/customize.dist/about.html index 954a3fb6f..3873351dc 100644 --- a/customize.dist/about.html +++ b/customize.dist/about.html @@ -39,6 +39,9 @@ Blog + + + diff --git a/customize.dist/contact.html b/customize.dist/contact.html index 5d43d15a5..182912748 100644 --- a/customize.dist/contact.html +++ b/customize.dist/contact.html @@ -39,6 +39,9 @@ Blog + + + diff --git a/customize.dist/index.html b/customize.dist/index.html index a1b1fe56b..9f5195b68 100644 --- a/customize.dist/index.html +++ b/customize.dist/index.html @@ -39,6 +39,9 @@ Blog + + + diff --git a/customize.dist/main.css b/customize.dist/main.css index 50572f14b..36bc87fdc 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -525,6 +525,22 @@ margin: 0px 10px; line-height: 40px; } +#cryptpadTopBar .right .buttonSuccess { + color: #fff; + background: #5cb85c; + border-color: #5cb85c; +} +#cryptpadTopBar .right .buttonSuccess:hover { + color: #fff; + background: #449d44; + border: 1px solid #419641; +} +#cryptpadTopBar .right .buttonSuccess span { + color: #fff; +} +#cryptpadTopBar .right .buttonSuccess .large { + margin-left: 5px; +} #cryptpadTopBar .right button .buttonTitle .fa-user { margin-right: 5px; } diff --git a/customize.dist/main.js b/customize.dist/main.js index 088e1f51a..4e150682a 100644 --- a/customize.dist/main.js +++ b/customize.dist/main.js @@ -2,7 +2,7 @@ define([ 'jquery', '/customize/application_config.js', '/common/cryptpad-common.js' -], function ($, Config, Cryptpad) { +], function ($, Config, Cryptpad, ApiConfig) { window.APP = { Cryptpad: Cryptpad, @@ -19,6 +19,8 @@ define([ $sel.find('button').addClass('btn').addClass('btn-secondary'); $sel.show(); + var $upgrade = $('#upgrade'); + // User admin menu var $userMenu = $('#user-menu'); var userMenuCfg = { @@ -31,7 +33,6 @@ define([ $('.cryptpad-dropdown').hide(); }); - // main block is hidden in case javascript is disabled $main.removeClass('hidden'); @@ -57,11 +58,17 @@ define([ }); }); + if (!localStorage.plan) { + $upgrade.show().text(Messages.upgradeAccount); + } + + $loggedInBlock.removeClass('hidden'); //return; } else { $main.find('#userForm').removeClass('hidden'); $('#name').focus(); + $upgrade.show().text(Messages.supportCryptpad); } var displayCreateButtons = function () { @@ -88,8 +95,8 @@ define([ var $block = Cryptpad.createDropdown(dropdownConfig); $block.find('button').addClass('btn').addClass('btn-primary'); $block.appendTo($parent); - }; + }; /* Log in UI */ var Login; diff --git a/customize.dist/privacy.html b/customize.dist/privacy.html index 35bab1958..13cf05dab 100644 --- a/customize.dist/privacy.html +++ b/customize.dist/privacy.html @@ -39,6 +39,9 @@ Blog + + + diff --git a/customize.dist/src/fragments/topbar.html b/customize.dist/src/fragments/topbar.html index a6b459b35..c1ed7e24b 100644 --- a/customize.dist/src/fragments/topbar.html +++ b/customize.dist/src/fragments/topbar.html @@ -24,4 +24,7 @@ Blog + + + diff --git a/customize.dist/src/less/topbar.less b/customize.dist/src/less/topbar.less index b10309f61..a394c4eeb 100644 --- a/customize.dist/src/less/topbar.less +++ b/customize.dist/src/less/topbar.less @@ -47,6 +47,24 @@ margin: 0px 10px; line-height: 40px; + .buttonSuccess { + // Bootstrap 4 colors + color: #fff; + background: @toolbar-green; + border-color: @toolbar-green; + &:hover { + color: #fff; + background: #449d44; + border: 1px solid #419641; + } + span { + color: #fff; + } + .large { + margin-left: 5px; + } + } + button { .buttonTitle { .fa-user { diff --git a/customize.dist/terms.html b/customize.dist/terms.html index 2504b1147..e5e09e9a0 100644 --- a/customize.dist/terms.html +++ b/customize.dist/terms.html @@ -39,6 +39,9 @@ Blog + + + diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index ddad01e68..0c68d425c 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -217,6 +217,7 @@ define([ userNameKey, userHashKey, 'loginToken', + 'plan', ].forEach(function (k) { sessionStorage.removeItem(k); localStorage.removeItem(k); @@ -1433,7 +1434,7 @@ define([ common.getPinLimit(function (e, limit, plan, note) { if (e) { return void console.error(e); } common.account.limit = limit; - common.account.plan = plan; + localStorage.plan = common.account.plan = plan; common.account.note = note; cb(); }); diff --git a/www/settings/index.html b/www/settings/index.html index f6ab459c9..3098251de 100644 --- a/www/settings/index.html +++ b/www/settings/index.html @@ -40,6 +40,9 @@ Blog + + + diff --git a/www/settings/main.js b/www/settings/main.js index 546c93749..0c16e9864 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -14,6 +14,8 @@ define([ _onRefresh: [] }; + var $upgrade = $('#upgrade'); + var Messages = Cryptpad.Messages; // Manage changes in the realtime object made from another page @@ -324,6 +326,15 @@ define([ APP.$container.append(createUserFeedbackToggle(obj)); obj.proxy.on('change', [], refresh); obj.proxy.on('remove', [], refresh); + + + if (Cryptpad.isLoggedIn()) { + if (!Cryptpad.account.plan) { + $upgrade.text(Messages.upgradeAccount).show(); + } + } else { + $upgrade.text(Messages.supportCryptpad).show(); + } }; $(function () { diff --git a/www/user/index.html b/www/user/index.html index f6ab459c9..3098251de 100644 --- a/www/user/index.html +++ b/www/user/index.html @@ -40,6 +40,9 @@ Blog + + +