From cfb6318b868cdd90e97b4cb709bb2cbcebed6b42 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 16 Dec 2019 16:06:22 +0100 Subject: [PATCH] Team invitation link, add alert --- .../src/less2/include/alertify.less | 4 +++ .../src/less2/include/modals-ui-elements.less | 12 +++++++ www/common/common-ui-elements.js | 32 +++++++++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 4bd5e298b..0a589a9de 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -71,6 +71,10 @@ z-index: 100000; // alertify container font: @colortheme_app-font; + .cp-inline-alert-text { + flex: 1; + } + &.forefront { z-index: @max-z-index; // alertify max forefront } diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 21707eab8..24e5d725f 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -28,4 +28,16 @@ .cp-app-prop-content { color: @cryptpad_text_col; } + + .cp-teams-invite-block { + display: flex; + align-items: center; + margin-bottom: 5px; + span { + flex: 1; + } + } + .cp-teams-invite-alert { + margin-top: 15px; + } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 27fd67dca..44717f635 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1636,7 +1636,9 @@ define([ var linkName, linkPassword, linkMessage, linkError, linkSpinText; var linkForm, linkSpin, linkResult; + var linkWarning; // Invite from link + var dismissButton = h('span.fa.fa-times'); var linkContent = h('div.cp-share-modal', [ h('p', 'XXX Invite link description...'), // XXX linkError = h('div.alert.alert-danger', {style : 'display: none;'}), @@ -1645,11 +1647,21 @@ define([ placeholder: 'name...' // XXX }), h('br'), + h('div.cp-teams-invite-block', [ + h('span', 'password protection...'), // XXX + h('a.cp-teams-help.fa.fa-question-circle', { + href: origin + '/faq.html#security-pad_password', + target: "_blank", + 'data-tippy-placement': "right" + }) + ]), // XXX linkPassword = UI.passwordInput({ id: 'cp-teams-invite-password', placeholder: 'password...' // XXX }), - h('br'), + h('div.cp-teams-invite-block', + h('span', 'add a note') // XXX + ), linkMessage = h('textarea', { // XXX ansuz hitting enter submits... placeholder: 'note...' // XXX }) @@ -1664,8 +1676,24 @@ define([ style: 'display: none;' }, h('textarea', { readonly: 'readonly' - })) + })), + linkWarning = h('div.cp-teams-invite-alert.alert.alert-warning.dismissable', { + style: "display: none;" + }, [ + h('span.cp-inline-alert-text', 'Warning...'), + dismissButton + ]) // XXX ]); + var localStore = window.cryptpadStore; + localStore.get('hide-alert-teamInvite', function (val) { + if (val === '1') { return; } + $(linkWarning).show(); + + $(dismissButton).on('click', function () { + localStore.put('hide-alert-teamInvite', '1'); + $(linkWarning).remove(); + }); + }); var $linkContent = $(linkContent); var href; var process = function () {