From f826e6aa3b46ebe5189fa96a25a219476951ffb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 25 Nov 2019 15:42:26 +0000 Subject: [PATCH 01/34] align filter input and buttons --- customize.dist/src/less2/include/usergrid.less | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index 38202de86..9201f7415 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -23,6 +23,8 @@ flex: 1; min-width: 0; margin-bottom: 0 !important; + height: 38px; + margin: 6px 8px 6px 0px; &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ color: @cryptpad_color_grey; opacity: 1; /* Firefox */ @@ -33,6 +35,10 @@ margin: 0; display: none; } + button:last-child { + margin-right: 0px !important; + } + } .cp-usergrid-user { width: 70px; From 8fc08538a1cefd22fcd920b026a0809bc438f2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 26 Nov 2019 11:21:58 +0000 Subject: [PATCH 02/34] open share modal on ready --- www/common/toolbar3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 224f7eeb6..2e503164c 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -533,7 +533,7 @@ MessengerUI, Messages) { Common.getSframeChannel().event('EV_SHARE_OPEN', { hidden: true }); - $shareBlock.click(function () { + $shareBlock.ready(function () { // XXX temporary open share modal on load var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From 66073804eed656ae65d69a59dc42ac66d73b8eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 26 Nov 2019 11:50:34 +0000 Subject: [PATCH 03/34] remove rounded corners on avatars --- customize.dist/src/less2/include/avatar.less | 1 - 1 file changed, 1 deletion(-) diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 87b4a3a32..9ef46482a 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -30,7 +30,6 @@ justify-content: center; align-items: center; - border-radius: 4px; overflow: hidden; box-sizing: content-box; } From 1da5e8ac3c2ea7e1b6ac972f8aba2d4a6d7ed7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 2 Dec 2019 11:34:34 +0000 Subject: [PATCH 04/34] usergrid avatar display and scrolling --- customize.dist/src/less2/include/avatar.less | 6 ++- .../src/less2/include/usergrid.less | 51 +++++++++++++------ www/common/common-ui-elements.js | 18 +++++-- 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 9ef46482a..4ba4e8c44 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -1,4 +1,5 @@ @import (reference) "./tools.less"; +@import (reference) "./colortheme-all.less"; .avatar_vars( @width: 30px ) { @@ -35,10 +36,11 @@ } .cp-avatar-default { .tools_unselectable(); - background: white; - color: black; + background: rgb(160, 160, 160); // XXX testing + color: @cryptpad_text_col; // XXX testing font-size: @avatar-font-size; font-size: var(--avatar-font-size); + text-transform: capitalize; } media-tag { min-height: @avatar-width; diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index ae56716a1..e3f1dad97 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -10,12 +10,12 @@ .cp-usergrid-grid { display: flex; flex-wrap: wrap; + margin: -3px; margin-bottom: 6px; - } - &:not(.large) { - .cp-usergrid-grid { - margin: -3px; - margin-bottom: 6px; + max-height: 130px; + overflow: auto; + @media screen and (max-height: 515px) { + max-height: unset; // remove double scrollbar } } &.cp-usergrid-empty { @@ -30,13 +30,13 @@ min-width: 0; margin-bottom: 0 !important; height: 38px; - margin: 6px 8px 6px 0px; + margin: 6px 0px; &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ color: @cryptpad_color_grey; opacity: 1; /* Firefox */ } } - margin-bottom: 15px; + margin-bottom: 10px; &:empty { margin: 0; display: none; @@ -54,7 +54,6 @@ justify-content: center; align-items: center; padding: 5px; - margin: 3px; cursor: default; transition: order 0.5s, background-color 0.5s; margin-top: 1px; @@ -64,10 +63,21 @@ background-color: @colortheme_alertify-primary; color: @colortheme_alertify-primary-text; order: -1 !important; + .cp-usergrid-avatar { + media-tag, .cp-avatar-default { + opacity: 0.7; + } + } } .cp-usergrid-user-avatar { min-height: 40px; } + &:not(.large) { + .cp-usergrid-user-name { + display: none; + } + } + .cp-usergrid-user-name { overflow: hidden; white-space: nowrap; @@ -75,23 +85,32 @@ width: 100%; text-align: center; line-height: 18px; + flex: 1; } - border: 1px solid @colortheme_alertify-primary; &:not(.large) { - .avatar_main(40px); + .avatar_main(60px); } &.large { .avatar_main(25px); - width: 140px; + width: 145px; height: 35px; flex-flow: row; - margin: 0; - margin-right: 15px; - margin-bottom: 1px; - &:nth-child(3n) { - margin-right: 0; + margin: 3px; + flex-basis: calc(33.3333333% - 6px); + flex-shrink: 1; + min-width: 0; + .cp-usergrid-user-name { + margin-left: 5px; + text-align: left; + color: @cryptpad_text_col; + } + } + &.cp-selected { + .cp-usergrid-user-name { + color: @colortheme_alertify-primary-text; } + } } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 280849e7f..652b2ab56 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -791,9 +791,7 @@ define([ var div = h('div.cp-usergrid-container' + noOthers + (config.large?'.large':''), [ label ? h('label', label) : undefined, h('div.cp-usergrid-filter', (config.noFilter || config.noSelect) ? undefined : [ - inputFilter, - buttonSelect, - buttonDeselect + inputFilter ]), ]); var $div = $(div); @@ -880,10 +878,21 @@ define([ delete friends[curve]; }); + var x = new Array(50).fill('test'); // XXX fake friend generator + x.forEach(function (el, i) { + friends[i] = { + edPublic: i, + curvePublic: i, + displayName: i + " pizza" // Hash.createChannelId() + }; + }); // XXX + + var friendsList = UIElements.getUserGrid(null, { common: common, data: friends, - noFilter: false + noFilter: false, + large: true }, refreshButtons); var friendDiv = friendsList.div; $div.append(friendDiv); @@ -909,6 +918,7 @@ define([ var teamsList = UIElements.getUserGrid(Messages.share_linkTeam, { common: common, noFilter: true, + large: true, data: teams }, refreshButtons); $div.append(teamsList.div); From ee1371c8ba85ab9a7ad2157a5a6e2f9bd618c9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 09:38:39 +0000 Subject: [PATCH 05/34] try to get rid of vertical scroll --- customize.dist/src/less2/include/usergrid.less | 2 +- www/common/drive-ui.js | 11 ++++++++++- www/common/toolbar3.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index e3f1dad97..28b90359a 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -13,7 +13,7 @@ margin: -3px; margin-bottom: 6px; max-height: 130px; - overflow: auto; + overflow-y: auto; @media screen and (max-height: 515px) { max-height: unset; // remove double scrollbar } diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 4c73a95a8..102ba876b 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4187,7 +4187,16 @@ define([ } getProperties(el, function (e, $prop) { if (e) { return void logError(e); } - UI.alert($prop[0], undefined, true); + var modal = UI.dialog.customModal($prop[0], { + buttons: [{ + className: 'secondary', + name: Messages.okButton, + onClick: function () {}, + keys: [13] + }], + onClose: config.onClose, + }); + UI.openCustomModal(modal); }); } else if ($this.hasClass("cp-app-drive-context-hashtag")) { diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 2e503164c..b6cb3c125 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -533,7 +533,7 @@ MessengerUI, Messages) { Common.getSframeChannel().event('EV_SHARE_OPEN', { hidden: true }); - $shareBlock.ready(function () { // XXX temporary open share modal on load + $shareBlock.click(function () { var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From 26c681c3cbf62b0380a2fce4cd9968b1626617ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 10:11:52 +0000 Subject: [PATCH 06/34] remove padding in prop modal - caused a vertical scrollbar - now constructed like the share modal (customModals inside tabs) --- www/common/common-ui-elements.js | 16 +++++++++++++--- www/common/drive-ui.js | 11 +---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 652b2ab56..4fd9860ff 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -737,12 +737,22 @@ define([ UIElements.getProperties = function (common, data, cb) { var c1; var c2; + var button = [{ + className: 'primary', + name: Messages.okButton, + onClick: function () {}, + keys: [13] + }]; NThen(function (waitFor) { getPadProperties(common, data, waitFor(function (e, c) { - c1 = c[0]; + c1 = UI.dialog.customModal(c[0], { + buttons: button + }); })); getRightsProperties(common, data, waitFor(function (e, c) { - c2 = c[0]; + c2 = UI.dialog.customModal(c[0], { + buttons: button + }); })); }).nThen(function () { var tabs = UI.dialog.tabs([{ @@ -1767,7 +1777,7 @@ define([ if (e) { return void console.error(e); } UIElements.getProperties(common, data, function (e, $prop) { if (e) { return void console.error(e); } - UI.alert($prop[0], undefined, true); + UI.openCustomModal($prop[0]); }); }); }); diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 102ba876b..bdb6144cb 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4187,16 +4187,7 @@ define([ } getProperties(el, function (e, $prop) { if (e) { return void logError(e); } - var modal = UI.dialog.customModal($prop[0], { - buttons: [{ - className: 'secondary', - name: Messages.okButton, - onClick: function () {}, - keys: [13] - }], - onClose: config.onClose, - }); - UI.openCustomModal(modal); + UI.openCustomModal($prop[0]); }); } else if ($this.hasClass("cp-app-drive-context-hashtag")) { From 5657793e9ccb3f0d4503627838b9023dbfe44a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 10:25:56 +0000 Subject: [PATCH 07/34] use .large avatars in manage owners --- customize.dist/src/less2/include/usergrid.less | 2 +- www/common/common-ui-elements.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index 28b90359a..59fed1d56 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -84,7 +84,7 @@ text-overflow: ellipsis; width: 100%; text-align: center; - line-height: 18px; + line-height: 20px; flex: 1; } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 4fd9860ff..8fa79b0a6 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -147,6 +147,7 @@ define([ : Messages.owner_removeText; var removeCol = UIElements.getUserGrid(msg, { common: common, + large: true, data: _owners, noFilter: true }, function () { @@ -238,6 +239,7 @@ define([ }); var addCol = UIElements.getUserGrid(Messages.owner_addText, { common: common, + large: true, data: _friends }, function () { //console.log(arguments); @@ -254,6 +256,7 @@ define([ }); var teamsList = UIElements.getUserGrid(Messages.owner_addTeamText, { common: common, + large: true, noFilter: true, data: teamsData }, function () {}); From d7b3a5ce678c84e954b4559b4f8804042fde898d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 10:43:27 +0000 Subject: [PATCH 08/34] adjust default avatar colors --- customize.dist/src/less2/include/avatar.less | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 4ba4e8c44..59a5189b8 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -5,6 +5,8 @@ ) { @avatar-width: @width; @avatar-font-size: @width / 1.2; + @avatar-default-bg: #D9D8D8; + @avatar-default-fg: darken(@avatar-default-bg, 40%); } .avatar_main(@width: 30px) { --LessLoader_require: LessLoader_currentFile(); @@ -36,8 +38,8 @@ } .cp-avatar-default { .tools_unselectable(); - background: rgb(160, 160, 160); // XXX testing - color: @cryptpad_text_col; // XXX testing + background:@avatar-default-bg; // XXX testing + color: @avatar-default-fg; // XXX testing font-size: @avatar-font-size; font-size: var(--avatar-font-size); text-transform: capitalize; From 2f087a392a0ca6e952e76cb25208e255d95dafa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 11:03:57 +0000 Subject: [PATCH 09/34] clean up XXXes --- customize.dist/src/less2/include/avatar.less | 4 ++-- www/common/common-ui-elements.js | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 59a5189b8..9cd14ebbc 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -38,8 +38,8 @@ } .cp-avatar-default { .tools_unselectable(); - background:@avatar-default-bg; // XXX testing - color: @avatar-default-fg; // XXX testing + background:@avatar-default-bg; + color: @avatar-default-fg; font-size: @avatar-font-size; font-size: var(--avatar-font-size); text-transform: capitalize; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 8fa79b0a6..785ad3e1e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -891,16 +891,6 @@ define([ delete friends[curve]; }); - var x = new Array(50).fill('test'); // XXX fake friend generator - x.forEach(function (el, i) { - friends[i] = { - edPublic: i, - curvePublic: i, - displayName: i + " pizza" // Hash.createChannelId() - }; - }); // XXX - - var friendsList = UIElements.getUserGrid(null, { common: common, data: friends, From 63c5fddf3891a3c9b5f189b4d25d4cb522ccbafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 11:07:18 +0000 Subject: [PATCH 10/34] lint --- customize.dist/src/less2/include/avatar.less | 2 +- customize.dist/src/less2/include/usergrid.less | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/customize.dist/src/less2/include/avatar.less b/customize.dist/src/less2/include/avatar.less index 9cd14ebbc..c85c34877 100644 --- a/customize.dist/src/less2/include/avatar.less +++ b/customize.dist/src/less2/include/avatar.less @@ -38,7 +38,7 @@ } .cp-avatar-default { .tools_unselectable(); - background:@avatar-default-bg; + background: @avatar-default-bg; color: @avatar-default-fg; font-size: @avatar-font-size; font-size: var(--avatar-font-size); diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index 59fed1d56..973b1a516 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -44,7 +44,6 @@ button:last-child { margin-right: 0px !important; } - } .cp-usergrid-user { width: 70px; @@ -110,7 +109,6 @@ .cp-usergrid-user-name { color: @colortheme_alertify-primary-text; } - } } } From 3b7732ceb298cbe405b63f0112ff4fb751aa7222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 12:01:31 +0000 Subject: [PATCH 11/34] display alert in link tab --- customize.dist/src/less2/include/alertify.less | 8 +++++++- www/common/common-ui-elements.js | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 9cd904c45..26cffc827 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -229,7 +229,7 @@ &[readonly] { background-color: @alertify-light-bg; color: @cryptpad_text_col; - border-color: @alertify-input-fg; + border-color: @alertify-light-bg; } } @@ -509,5 +509,11 @@ overflow-x: auto; } } + .alert { + margin:5px 0px; + font-size:12px; + padding:5px; + border-radius:0px; + } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index b8ae705a2..e448688f5 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1068,6 +1068,16 @@ define([ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), h('br'), ]; + // check if the pad is password protection + var hash = hashes.editHash || hashes.viewHash; + var href = origin + pathname + '#' + hash; + var parsedHref = Hash.parsePadUrl(href); + var hasPassword = parsedHref.hashData.password; + if (hasPassword) { + linkContent.push(h('div.alert.alert-danger', [h('i.fa.fa-lock'), + ' ', 'has password'])) + }; + linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); var link = h('div.cp-share-modal', linkContent); From a38fa71d571ab1b52ec1ec0ae32830ed722bb04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 3 Dec 2019 14:52:46 +0000 Subject: [PATCH 12/34] use translation key for alert message --- www/common/common-ui-elements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index e448688f5..e1f7dc445 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1075,7 +1075,7 @@ define([ var hasPassword = parsedHref.hashData.password; if (hasPassword) { linkContent.push(h('div.alert.alert-danger', [h('i.fa.fa-lock'), - ' ', 'has password'])) + ' ', Messages.share_linkPasswordAlert])) }; linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); From 1ba03dee452a5853e2f1c5c9101d32596fe1fc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 4 Dec 2019 11:41:08 +0000 Subject: [PATCH 13/34] position and style alert --- .../src/less2/include/alertify.less | 5 ++++ www/common/common-ui-elements.js | 30 +++++++++++++------ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 26cffc827..585627a28 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -514,6 +514,11 @@ font-size:12px; padding:5px; border-radius:0px; + &.alert-primary { + background-color: @alertify-base; + color: @alertify-fg; + border-color: @alertify-fg; + } } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 26791a204..76d296606 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1027,6 +1027,12 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } + // check if the pad is password protected + var hash = hashes.editHash || hashes.viewHash; + var href = origin + pathname + '#' + hash; + var parsedHref = Hash.parsePadUrl(href); + var hasPassword = parsedHref.hashData.password; + var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; @@ -1081,18 +1087,15 @@ define([ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), h('br'), ]; - // check if the pad is password protection - var hash = hashes.editHash || hashes.viewHash; - var href = origin + pathname + '#' + hash; - var parsedHref = Hash.parsePadUrl(href); - var hasPassword = parsedHref.hashData.password; + + linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); + + // Show alert if the pad is password protected if (hasPassword) { - linkContent.push(h('div.alert.alert-danger', [h('i.fa.fa-lock'), + linkContent.push(h('div.alert.alert-primary', [h('i.fa.fa-lock'), ' ', Messages.share_linkPasswordAlert])) }; - linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); - var link = h('div.cp-share-modal', linkContent); var $link = $(link); @@ -1158,7 +1161,16 @@ define([ // XXX Don't display access rights if no contacts var contactsContent = h('div.cp-share-modal'); - $(contactsContent).append(friendsList); + var $contactsContent = $(contactsContent); + + $contactsContent.append(friendsList); + + // Show alert if the pad is password protected + if (hasPassword) { + $contactsContent.append(h('div.alert.alert-primary', [h('i.fa.fa-unlock'), + ' ', Messages.share_contactPasswordAlert])) + }; + var contactButtons = [makeCancelButton(), friendsObject.button]; From ee35c1d1515a6c2355d5594b542370e63a8d007e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 4 Dec 2019 12:46:56 +0000 Subject: [PATCH 14/34] display share link in textarea --- customize.dist/src/less2/include/alertify.less | 7 +++++++ www/common/common-interface.js | 12 ++++++++++++ www/common/common-ui-elements.js | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 585627a28..354b29174 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -233,6 +233,13 @@ } } + textarea { + overflow: hidden; + &[readonly] { + resize: none; + } + } + span.cp-password-container { display: flex; align-items: center; diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 8efc7397a..8dc14cc8c 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -127,6 +127,18 @@ define([ return input; }; + dialog.selectableArea = function (value, opt) { + var attrs = merge({ + readonly: 'readonly', + }, opt); + + var input = h('textarea', attrs); + $(input).val(value).click(function () { + input.select(); + }); + return input; + }; + dialog.okButton = function (content, classString) { var sel = typeof(classString) === 'string'? 'button.ok.' + classString:'button.ok.primary'; return h(sel, { tabindex: '2', }, content || Messages.okButton); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 76d296606..fd64571ab 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1088,7 +1088,7 @@ define([ h('br'), ]; - linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); + linkContent.push(UI.dialog.selectableArea('', { id: 'cp-share-link-preview', tabindex: 1, rows:3})); // Show alert if the pad is password protected if (hasPassword) { From 1d2f40e6cc1daa0f12a6febf712cd1830c643a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 10:10:48 +0000 Subject: [PATCH 15/34] try to add link to password FAQ --- www/common/common-ui-elements.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index fd64571ab..7b3603ccc 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1033,6 +1033,12 @@ define([ var parsedHref = Hash.parsePadUrl(href); var hasPassword = parsedHref.hashData.password; + var faqLink = h('a', {href: '#'}, Messages.passwordFaqLink); + $(faqLink).click(function () { + console.log(config.origin + "/faq.html#security-pad_password"); + common.openURL(config.origin + "/faq.html#security-pad_password"); + }); + var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; @@ -1192,6 +1198,17 @@ define([ h('br'), UI.dialog.selectable(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1 }) ]; + + // Show alert if the pad is password protected + // + if (hasPassword) { + embedContent.push(h('div.alert.alert-primary', [ + h('i.fa.fa-lock'), ' ', + Messages.share_embedPasswordAlert, ' ', + faqLink + ])) + }; + var embedButtons = [ makeCancelButton(), { className: 'primary', From f3b1761d0d116f13687222223bd0f9e6eadfa607 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 5 Dec 2019 11:33:43 +0100 Subject: [PATCH 16/34] Enable openURL and gotoURL in the share iframe --- www/common/sframe-common-outer.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index e439d04c1..e0571bb16 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -488,6 +488,20 @@ define([ Cryptpad.storeInTeam(data, cb); }); + sframeChan.on('EV_GOTO_URL', function (url) { + if (url) { + window.location.href = url; + } else { + window.location.reload(); + } + }); + + sframeChan.on('EV_OPEN_URL', function (url) { + if (url) { + window.open(url); + } + }); + }; addCommonRpc(sframeChan); @@ -956,20 +970,6 @@ define([ }); }); - sframeChan.on('EV_GOTO_URL', function (url) { - if (url) { - window.location.href = url; - } else { - window.location.reload(); - } - }); - - sframeChan.on('EV_OPEN_URL', function (url) { - if (url) { - window.open(url); - } - }); - sframeChan.on('Q_PIN_GET_USAGE', function (teamId, cb) { Cryptpad.isOverPinLimit(teamId, function (err, overLimit, data) { cb({ From 951a59f3ea2a5848e1840214df6596bb4c3b1827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 10:55:52 +0000 Subject: [PATCH 17/34] add password FAQ links to share modal tabs --- www/common/common-ui-elements.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 7b3603ccc..70aceaf89 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1033,11 +1033,14 @@ define([ var parsedHref = Hash.parsePadUrl(href); var hasPassword = parsedHref.hashData.password; - var faqLink = h('a', {href: '#'}, Messages.passwordFaqLink); - $(faqLink).click(function () { - console.log(config.origin + "/faq.html#security-pad_password"); - common.openURL(config.origin + "/faq.html#security-pad_password"); - }); + var makeFaqLink = function () { + var link = h('a', {href: '#'}, Messages.passwordFaqLink); + $(link).click(function () { + common.openURL(config.origin + "/faq.html#security-pad_password"); + }); + return link; + }; + var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; @@ -1098,8 +1101,11 @@ define([ // Show alert if the pad is password protected if (hasPassword) { - linkContent.push(h('div.alert.alert-primary', [h('i.fa.fa-lock'), - ' ', Messages.share_linkPasswordAlert])) + linkContent.push(h('div.alert.alert-primary', [ + h('i.fa.fa-lock'), ' ', + Messages.share_linkPasswordAlert, ' ', + makeFaqLink() + ])) }; var link = h('div.cp-share-modal', linkContent); @@ -1173,8 +1179,11 @@ define([ // Show alert if the pad is password protected if (hasPassword) { - $contactsContent.append(h('div.alert.alert-primary', [h('i.fa.fa-unlock'), - ' ', Messages.share_contactPasswordAlert])) + $contactsContent.append(h('div.alert.alert-primary', [ + h('i.fa.fa-lock'), ' ', + Messages.share_contactPasswordAlert, ' ', + makeFaqLink() + ])) }; @@ -1200,12 +1209,11 @@ define([ ]; // Show alert if the pad is password protected - // if (hasPassword) { embedContent.push(h('div.alert.alert-primary', [ h('i.fa.fa-lock'), ' ', Messages.share_embedPasswordAlert, ' ', - faqLink + makeFaqLink() ])) }; From e138dc8c6a40028423ab6a127306e157c6534f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 10:58:54 +0000 Subject: [PATCH 18/34] display embed code in textarea --- customize.dist/src/less2/include/alertify.less | 1 + www/common/common-ui-elements.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 354b29174..b3c32aec7 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -235,6 +235,7 @@ textarea { overflow: hidden; + padding: 8px; &[readonly] { resize: none; } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 70aceaf89..64104ab6d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1204,8 +1204,7 @@ define([ }; var embedContent = [ h('p', Messages.viewEmbedTag), - h('br'), - UI.dialog.selectable(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1 }) + UI.dialog.selectableArea(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1, rows: 3}) ]; // Show alert if the pad is password protected From 5d599887cff7833946a71debaaff11c0c565ab3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 11:01:29 +0000 Subject: [PATCH 19/34] style links in bootsstrap alerts --- customize.dist/src/less2/include/alertify.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index b3c32aec7..138b9930b 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -526,7 +526,12 @@ background-color: @alertify-base; color: @alertify-fg; border-color: @alertify-fg; + a { + color: @alertify-fg; + text-decoration: underline; + } } + } } From 22873fe1f7f3a774d6f4bc488e37bd2e228b6dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 11:16:12 +0000 Subject: [PATCH 20/34] adjustments to FAQ password links --- www/common/common-ui-elements.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 64104ab6d..1ac27403f 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1034,7 +1034,7 @@ define([ var hasPassword = parsedHref.hashData.password; var makeFaqLink = function () { - var link = h('a', {href: '#'}, Messages.passwordFaqLink); + var link = h('a', {href: '#'}, [h('i.fa.fa-question-circle'), ' ', Messages.passwordFaqLink]); $(link).click(function () { common.openURL(config.origin + "/faq.html#security-pad_password"); }); @@ -1103,7 +1103,7 @@ define([ if (hasPassword) { linkContent.push(h('div.alert.alert-primary', [ h('i.fa.fa-lock'), ' ', - Messages.share_linkPasswordAlert, ' ', + Messages.share_linkPasswordAlert, h('br'), makeFaqLink() ])) }; @@ -1180,8 +1180,8 @@ define([ // Show alert if the pad is password protected if (hasPassword) { $contactsContent.append(h('div.alert.alert-primary', [ - h('i.fa.fa-lock'), ' ', - Messages.share_contactPasswordAlert, ' ', + h('i.fa.fa-unlock'), ' ', + Messages.share_contactPasswordAlert, h('br'), makeFaqLink() ])) }; @@ -1211,7 +1211,7 @@ define([ if (hasPassword) { embedContent.push(h('div.alert.alert-primary', [ h('i.fa.fa-lock'), ' ', - Messages.share_embedPasswordAlert, ' ', + Messages.share_embedPasswordAlert, h('br'), makeFaqLink() ])) }; From 708ad7a10d1b92d9dfd43ef2b8249c53022f4d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 11:19:46 +0000 Subject: [PATCH 21/34] linting --- customize.dist/src/less2/include/alertify.less | 9 ++++----- www/common/common-ui-elements.js | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 138b9930b..de15c05bd 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -518,10 +518,10 @@ } } .alert { - margin:5px 0px; - font-size:12px; - padding:5px; - border-radius:0px; + margin: 5px 0px; + font-size: 12px; + padding: 5px; + border-radius: 0px; &.alert-primary { background-color: @alertify-base; color: @alertify-fg; @@ -531,7 +531,6 @@ text-decoration: underline; } } - } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 1ac27403f..922ec61fd 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1105,8 +1105,8 @@ define([ h('i.fa.fa-lock'), ' ', Messages.share_linkPasswordAlert, h('br'), makeFaqLink() - ])) - }; + ])); + } var link = h('div.cp-share-modal', linkContent); var $link = $(link); @@ -1183,8 +1183,8 @@ define([ h('i.fa.fa-unlock'), ' ', Messages.share_contactPasswordAlert, h('br'), makeFaqLink() - ])) - }; + ])); + } var contactButtons = [makeCancelButton(), @@ -1213,8 +1213,8 @@ define([ h('i.fa.fa-lock'), ' ', Messages.share_embedPasswordAlert, h('br'), makeFaqLink() - ])) - }; + ])); + } var embedButtons = [ makeCancelButton(), { From 0be5b90495ba23dcf276995185f1ea9027ecf5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 11:28:46 +0000 Subject: [PATCH 22/34] avoid underlined space at start of FAQ link --- www/common/common-ui-elements.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 922ec61fd..d5ac033a9 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1034,7 +1034,10 @@ define([ var hasPassword = parsedHref.hashData.password; var makeFaqLink = function () { - var link = h('a', {href: '#'}, [h('i.fa.fa-question-circle'), ' ', Messages.passwordFaqLink]); + var link = h('span', [ + h('i.fa.fa-question-circle'), ' ', + h('a', {href: '#'}, Messages.passwordFaqLink) + ]); $(link).click(function () { common.openURL(config.origin + "/faq.html#security-pad_password"); }); From 9ec2dd8e70e58f1f0868ba6f9a7bce72c868390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 11:46:34 +0000 Subject: [PATCH 23/34] remove grey bg on password reveal eye btn --- customize.dist/src/less2/include/password-input.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/password-input.less b/customize.dist/src/less2/include/password-input.less index 79824bac7..0f476390a 100644 --- a/customize.dist/src/less2/include/password-input.less +++ b/customize.dist/src/less2/include/password-input.less @@ -1,3 +1,4 @@ +@import (reference) "./colortheme-all.less"; .password_main() { --LessLoader_require: LessLoader_currentFile(); } @@ -17,7 +18,7 @@ justify-content: center; cursor: pointer; &:hover { - background-color: rgba(0,0,0,0.1); + color: darken(@colortheme_alertify-primary, 10%); } } } From 78488d00bf3ba3b702f3c9e322ccfe7b2684196f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 14:52:04 +0000 Subject: [PATCH 24/34] adjust spacing --- customize.dist/src/less2/include/alertify.less | 14 ++++++++++++-- .../src/less2/include/modals-ui-elements.less | 3 ++- customize.dist/src/less2/include/usergrid.less | 1 + www/common/common-ui-elements.js | 1 - 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index de15c05bd..07b8cb491 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -222,7 +222,7 @@ background-color: @alertify-input-fg; color: @cryptpad_text_col; border: 1px solid @alertify-input-bg; - margin-bottom: 15px; + margin: @alertify_padding-base 0px; width: 100%; font-size: 100%; padding: @alertify_padding-base; @@ -365,6 +365,7 @@ nav { padding: @alertify_padding-base; + padding-top: 0px; text-align: right; button { margin: 0px !important; @@ -518,7 +519,7 @@ } } .alert { - margin: 5px 0px; + margin: 0px 0px @alertify_padding-base 0px; font-size: 12px; padding: 5px; border-radius: 0px; @@ -531,6 +532,15 @@ text-decoration: underline; } } + &.dismissable { + display: flex; + align-items: center; + span.fa-times { + font-size: @colortheme_app-font-size; + margin-left: 20px; + cursor: pointer; + } + } } } diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 6e3921781..28bd63278 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -1,5 +1,5 @@ @import (reference) "./colortheme-all.less"; - +@import (reference) "./variables.less"; .modals-ui-elements_main() { --LessLoader_require: LessLoader_currentFile(); } @@ -7,6 +7,7 @@ // Share modal .msg.cp-inline-radio-group { overflow: unset !important; + padding: 0px @variables_padding; .radio-group { display: flex; flex-direction: row; diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index 973b1a516..f4e72591e 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -28,6 +28,7 @@ input { flex: 1; min-width: 0; + margin-top: 0 !important; margin-bottom: 0 !important; height: 38px; margin: 6px 0px; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index d5ac033a9..2b6ad9717 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1097,7 +1097,6 @@ define([ h('br'), ] : [ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), - h('br'), ]; linkContent.push(UI.dialog.selectableArea('', { id: 'cp-share-link-preview', tabindex: 1, rows:3})); From bee6aa42bf74f544a2a37fc047961413be761718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 14:57:18 +0000 Subject: [PATCH 25/34] add inline alert in link tab --- www/common/common-ui-elements.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 2b6ad9717..71bca3a0c 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1110,6 +1110,12 @@ define([ ])); } + // Show alert if user has not dismissed it in the past + linkContent.push(h('div.alert.alert-danger.dismissable', [ + h('span.cp-inline-alert-text', Messages.share_linkWarning), + h('span.fa.fa-times') + ])); + var link = h('div.cp-share-modal', linkContent); var $link = $(link); From 0e4b7623ff4bee99c0b941f29307ee6634d838be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 5 Dec 2019 15:52:16 +0000 Subject: [PATCH 26/34] adjust spacing - fixed spacing to work also in properties modal --- customize.dist/src/less2/include/alertify.less | 5 ++++- customize.dist/src/less2/include/modals-ui-elements.less | 3 +++ www/common/common-ui-elements.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 07b8cb491..6692955e7 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -159,6 +159,9 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; + label{ + margin-bottom: 0px; + } } .alertify-tabs { max-height: 100%; @@ -222,7 +225,7 @@ background-color: @alertify-input-fg; color: @cryptpad_text_col; border: 1px solid @alertify-input-bg; - margin: @alertify_padding-base 0px; + margin-bottom: @alertify_padding-base; width: 100%; font-size: 100%; padding: @alertify_padding-base; diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 28bd63278..1d91767ba 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -4,6 +4,9 @@ --LessLoader_require: LessLoader_currentFile(); } & { + .cp-spacer{ + height: @variables_padding; + } // Share modal .msg.cp-inline-radio-group { overflow: unset !important; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 71bca3a0c..fa7ae38ea 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1098,7 +1098,7 @@ define([ ] : [ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), ]; - + linkContent.push(h('div.cp-spacer')) linkContent.push(UI.dialog.selectableArea('', { id: 'cp-share-link-preview', tabindex: 1, rows:3})); // Show alert if the pad is password protected From 72a855aa6abe3ba003ca76eac7572253a7a8bc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Fri, 6 Dec 2019 15:35:10 +0000 Subject: [PATCH 27/34] change link alert to warning --- www/common/common-ui-elements.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index fa7ae38ea..6fe865647 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1110,10 +1110,9 @@ define([ ])); } - // Show alert if user has not dismissed it in the past - linkContent.push(h('div.alert.alert-danger.dismissable', [ + linkContent.push(h('div.alert.alert-warning.dismissable', [ h('span.cp-inline-alert-text', Messages.share_linkWarning), - h('span.fa.fa-times') + h('span.fa.fa-times') // XXX dismiss message and remember ])); var link = h('div.cp-share-modal', linkContent); From 713d67439f00211bad67f37643b91c12079b263a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Fri, 6 Dec 2019 16:52:53 +0000 Subject: [PATCH 28/34] review --- .../src/less2/include/alertify.less | 6 ++-- .../src/less2/include/usergrid.less | 13 ++++----- www/common/common-ui-elements.js | 28 ++++--------------- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 6692955e7..b1143ff38 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -159,8 +159,8 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; - label{ - margin-bottom: 0px; + :last-child{ + margin-bottom: 0; } } .alertify-tabs { @@ -368,7 +368,6 @@ nav { padding: @alertify_padding-base; - padding-top: 0px; text-align: right; button { margin: 0px !important; @@ -521,6 +520,7 @@ overflow-x: auto; } } + // Bootstrap Alerts .alert { margin: 0px 0px @alertify_padding-base 0px; font-size: 12px; diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index f4e72591e..37c406d52 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -6,7 +6,9 @@ --LessLoader_require: LessLoader_currentFile(); }; & { + .cp-usergrid-container { + margin-bottom: 12px; // XXX add margin at bottom of user grids .cp-usergrid-grid { display: flex; flex-wrap: wrap; @@ -28,10 +30,9 @@ input { flex: 1; min-width: 0; - margin-top: 0 !important; + margin: 0; margin-bottom: 0 !important; height: 38px; - margin: 6px 0px; &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ color: @cryptpad_color_grey; opacity: 1; /* Firefox */ @@ -54,6 +55,7 @@ justify-content: center; align-items: center; padding: 5px; + margin: 3px; cursor: default; transition: order 0.5s, background-color 0.5s; margin-top: 1px; @@ -72,11 +74,6 @@ .cp-usergrid-user-avatar { min-height: 40px; } - &:not(.large) { - .cp-usergrid-user-name { - display: none; - } - } .cp-usergrid-user-name { overflow: hidden; @@ -89,7 +86,7 @@ } &:not(.large) { - .avatar_main(60px); + .avatar_main(40px); } &.large { .avatar_main(25px); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 6fe865647..ccc837766 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -795,8 +795,6 @@ define([ var noOthers = icons.length === 0 ? '.cp-usergrid-empty' : ''; - var buttonSelect = h('button', Messages.share_selectAll); - var buttonDeselect = h('button', Messages.share_deselectAll); var inputFilter = h('input', { placeholder: Messages.share_filterFriend }); @@ -817,23 +815,8 @@ define([ $div.find('.cp-usergrid-user:not(.cp-selected):not([data-name*="'+name+'"])').hide(); } }; - $(inputFilter).on('keydown keyup change', redraw); - $(buttonSelect).click(function () { - $div.find('.cp-usergrid-user:not(.cp-selected):visible').addClass('cp-selected'); - onSelect(); - }); - $(buttonDeselect).click(function () { - $div.find('.cp-usergrid-user.cp-selected').removeClass('cp-selected').each(function (i, el) { - var order = $(el).attr('data-order'); - if (!order) { return; } - $(el).attr('style', 'order:'+order); - }); - redraw(); - onSelect(); - }); - $(div).append(h('div.cp-usergrid-grid', icons)); if (!config.noSelect) { $div.on('click', '.cp-usergrid-user', function () { @@ -1035,7 +1018,7 @@ define([ var makeFaqLink = function () { var link = h('span', [ - h('i.fa.fa-question-circle'), ' ', + h('i.fa.fa-question-circle'), ' ', // XXX remove and make it a margin h('a', {href: '#'}, Messages.passwordFaqLink) ]); $(link).click(function () { @@ -1098,13 +1081,13 @@ define([ ] : [ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), ]; - linkContent.push(h('div.cp-spacer')) + linkContent.push(h('div.cp-spacer')); linkContent.push(UI.dialog.selectableArea('', { id: 'cp-share-link-preview', tabindex: 1, rows:3})); // Show alert if the pad is password protected if (hasPassword) { linkContent.push(h('div.alert.alert-primary', [ - h('i.fa.fa-lock'), ' ', + h('i.fa.fa-lock'), ' ', // XXX remove and make it a margin Messages.share_linkPasswordAlert, h('br'), makeFaqLink() ])); @@ -1187,7 +1170,7 @@ define([ // Show alert if the pad is password protected if (hasPassword) { $contactsContent.append(h('div.alert.alert-primary', [ - h('i.fa.fa-unlock'), ' ', + h('i.fa.fa-unlock'), ' ', // XXX remove and make it a margin Messages.share_contactPasswordAlert, h('br'), makeFaqLink() ])); @@ -1317,6 +1300,7 @@ define([ return modal; }; + // XXX add password messages to file share UIElements.createFileShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1387,10 +1371,8 @@ define([ // Embed tab var embed = h('div.cp-share-modal', [ h('p', Messages.fileEmbedScript), - h('br'), UI.dialog.selectable(common.getMediatagScript()), h('p', Messages.fileEmbedTag), - h('br'), UI.dialog.selectable(common.getMediatagFromHref(fileData)), ]); var embedButtons = [{ From 9b5c3878b16963e82f03344bcad2932d763a42d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 09:57:41 +0000 Subject: [PATCH 29/34] add password messages to file share modal --- www/common/common-ui-elements.js | 53 ++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ccc837766..e9dc55471 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1311,6 +1311,21 @@ define([ if (!hashes.fileHash) { throw new Error("You must provide a file hash"); } var url = origin + pathname + '#' + hashes.fileHash; + // check if the file is password protected + var parsedHref = Hash.parsePadUrl(url); + var hasPassword = parsedHref.hashData.password; + + var makeFaqLink = function () { + var link = h('span', [ + h('i.fa.fa-question-circle'), ' ', // XXX remove and make it a margin + h('a', {href: '#'}, Messages.passwordFaqLink) + ]); + $(link).click(function () { + common.openURL(config.origin + "/faq.html#security-pad_password"); + }); + return link; + }; + var getLinkValue = function () { return url; }; var makeCancelButton = function() { @@ -1322,9 +1337,23 @@ define([ // Share link tab var linkContent = [ - UI.dialog.selectable(getLinkValue(), { id: 'cp-share-link-preview', tabindex: 1 }) + UI.dialog.selectableArea(getLinkValue(), { id: 'cp-share-link-preview', tabindex: 1, rows:2 }) ]; + // Show alert if the pad is password protected + if (hasPassword) { + linkContent.push(h('div.alert.alert-primary', [ + h('i.fa.fa-lock'), ' ', // XXX remove and make it a margin + Messages.share_linkPasswordAlert, h('br'), + makeFaqLink() + ])); + } + + linkContent.push(h('div.alert.alert-warning.dismissable', [ + h('span.cp-inline-alert-text', Messages.share_linkWarning), + h('span.fa.fa-times') // XXX dismiss message and remember + ])); + var link = h('div.cp-share-modal', linkContent); var linkButtons = [ @@ -1357,7 +1386,17 @@ define([ var friendsList = friendsObject.content; var contactsContent = h('div.cp-share-modal'); - $(contactsContent).append(friendsList); + var $contactsContent = $(contactsContent); + $contactsContent.append(friendsList); + + // Show alert if the pad is password protected + if (hasPassword) { + $contactsContent.append(h('div.alert.alert-primary', [ + h('i.fa.fa-unlock'), ' ', // XXX remove and make it a margin + Messages.share_contactPasswordAlert, h('br'), + makeFaqLink() + ])); + } var contactButtons = [makeCancelButton(), friendsObject.button]; @@ -1375,6 +1414,16 @@ define([ h('p', Messages.fileEmbedTag), UI.dialog.selectable(common.getMediatagFromHref(fileData)), ]); + + // Show alert if the pad is password protected + if (hasPassword) { + embed.append(h('div.alert.alert-primary', [ + h('i.fa.fa-lock'), ' ', + Messages.share_embedPasswordAlert, h('br'), + makeFaqLink() + ])); + } + var embedButtons = [{ className: 'cancel', name: Messages.cancel, From be40254f1aa79036b0631da082af3da43563efcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 10:02:44 +0000 Subject: [PATCH 30/34] remove spaces in password messages - space between icon and text is now a margin --- www/common/common-ui-elements.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index e9dc55471..9338471a7 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1018,7 +1018,7 @@ define([ var makeFaqLink = function () { var link = h('span', [ - h('i.fa.fa-question-circle'), ' ', // XXX remove and make it a margin + h('i.fa.fa-question-circle'), h('a', {href: '#'}, Messages.passwordFaqLink) ]); $(link).click(function () { @@ -1033,7 +1033,6 @@ define([ var rights = h('div.msg.cp-inline-radio-group', [ h('label', Messages.share_linkAccess), - h('br'), h('div.radio-group',[ UI.createRadio('accessRights', 'cp-share-editable-false', Messages.share_linkView, true, { mark: {tabindex:1} }), @@ -1087,7 +1086,7 @@ define([ // Show alert if the pad is password protected if (hasPassword) { linkContent.push(h('div.alert.alert-primary', [ - h('i.fa.fa-lock'), ' ', // XXX remove and make it a margin + h('i.fa.fa-lock'), Messages.share_linkPasswordAlert, h('br'), makeFaqLink() ])); @@ -1170,7 +1169,7 @@ define([ // Show alert if the pad is password protected if (hasPassword) { $contactsContent.append(h('div.alert.alert-primary', [ - h('i.fa.fa-unlock'), ' ', // XXX remove and make it a margin + h('i.fa.fa-unlock'), Messages.share_contactPasswordAlert, h('br'), makeFaqLink() ])); @@ -1300,7 +1299,6 @@ define([ return modal; }; - // XXX add password messages to file share UIElements.createFileShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1317,7 +1315,7 @@ define([ var makeFaqLink = function () { var link = h('span', [ - h('i.fa.fa-question-circle'), ' ', // XXX remove and make it a margin + h('i.fa.fa-question-circle'), h('a', {href: '#'}, Messages.passwordFaqLink) ]); $(link).click(function () { @@ -1343,7 +1341,7 @@ define([ // Show alert if the pad is password protected if (hasPassword) { linkContent.push(h('div.alert.alert-primary', [ - h('i.fa.fa-lock'), ' ', // XXX remove and make it a margin + h('i.fa.fa-lock'), Messages.share_linkPasswordAlert, h('br'), makeFaqLink() ])); @@ -1392,7 +1390,7 @@ define([ // Show alert if the pad is password protected if (hasPassword) { $contactsContent.append(h('div.alert.alert-primary', [ - h('i.fa.fa-unlock'), ' ', // XXX remove and make it a margin + h('i.fa.fa-unlock'), Messages.share_contactPasswordAlert, h('br'), makeFaqLink() ])); From df9f2c9c293af7343b7f547132d4f82b5771b5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 11:14:05 +0000 Subject: [PATCH 31/34] dismiss warning about sharing links - remember if warning has been dismissed - include this in tips that can be reset - move the option to reset tips to the account settings --- www/common/common-ui-elements.js | 52 +++++++++++++++++++++++++++----- www/settings/inner.js | 4 +-- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 9338471a7..46befaac2 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1092,10 +1092,29 @@ define([ ])); } - linkContent.push(h('div.alert.alert-warning.dismissable', [ - h('span.cp-inline-alert-text', Messages.share_linkWarning), - h('span.fa.fa-times') // XXX dismiss message and remember - ])); + // warning about sharing links + var localStore = window.cryptpadStore; + var dismissButton = h('span.fa.fa-times'); + var shareLinkWarning = h('div.alert.alert-warning.dismissable', + { style: 'display: none;' }, + [ + h('span.cp-inline-alert-text', Messages.share_linkWarning), + dismissButton + ]); + linkContent.push(shareLinkWarning); + + localStore.get('hide-alert-shareLinkWarning', function (val) { + if (val === '1') { return; } + $(shareLinkWarning).show(); + + $(dismissButton).on('click', function () { + localStore.put('hide-alert-shareLinkWarning', '1'); + $(shareLinkWarning).remove(); + }); + + }); + + var link = h('div.cp-share-modal', linkContent); var $link = $(link); @@ -1347,10 +1366,27 @@ define([ ])); } - linkContent.push(h('div.alert.alert-warning.dismissable', [ - h('span.cp-inline-alert-text', Messages.share_linkWarning), - h('span.fa.fa-times') // XXX dismiss message and remember - ])); + // warning about sharing links + var localStore = window.cryptpadStore; + var dismissButton = h('span.fa.fa-times'); + var shareLinkWarning = h('div.alert.alert-warning.dismissable', + { style: 'display: none;' }, + [ + h('span.cp-inline-alert-text', Messages.share_linkWarning), + dismissButton + ]); + linkContent.push(shareLinkWarning); + + localStore.get('hide-alert-shareLinkWarning', function (val) { + if (val === '1') { return; } + $(shareLinkWarning).show(); + + $(dismissButton).on('click', function () { + localStore.put('hide-alert-shareLinkWarning', '1'); + $(shareLinkWarning).remove(); + }); + + }); var link = h('div.cp-share-modal', linkContent); diff --git a/www/settings/inner.js b/www/settings/inner.js index d67f62818..7c9dd0630 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -51,6 +51,7 @@ define([ 'cp-settings-info-block', 'cp-settings-displayname', 'cp-settings-language-selector', + 'cp-settings-resettips', 'cp-settings-logout-everywhere', 'cp-settings-autostore', 'cp-settings-userfeedback', @@ -67,7 +68,6 @@ define([ ], 'drive': [ 'cp-settings-drive-duplicate', - 'cp-settings-resettips', 'cp-settings-thumbnails', 'cp-settings-drive-backup', 'cp-settings-drive-import-local', @@ -835,7 +835,7 @@ define([ var localStore = window.cryptpadStore; $button.click(function () { Object.keys(localStore.store).forEach(function (k) { - if(k.slice(0, 9) === "hide-info") { + if(/^(hide-(info|alert))/.test(k)) { localStore.put(k, null); } }); From e9c0e1a71057974ff2239dd7c546800b07369e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 11:15:52 +0000 Subject: [PATCH 32/34] icon spacing --- customize.dist/src/less2/include/alertify.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index b1143ff38..96a8ae506 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -526,6 +526,9 @@ font-size: 12px; padding: 5px; border-radius: 0px; + i { + margin-right: 10px; + } &.alert-primary { background-color: @alertify-base; color: @alertify-fg; From f04d4e1010e1ba9f4275d6b3be9e6a5f2e3e1955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 11:34:00 +0000 Subject: [PATCH 33/34] adjust spacing of usergrid --- customize.dist/src/less2/include/usergrid.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index 37c406d52..a171b0950 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -8,7 +8,7 @@ & { .cp-usergrid-container { - margin-bottom: 12px; // XXX add margin at bottom of user grids + margin-bottom: 12px !important; // even when last child of .msg .cp-usergrid-grid { display: flex; flex-wrap: wrap; @@ -100,6 +100,7 @@ .cp-usergrid-user-name { margin-left: 5px; text-align: left; + line-height: 150%; color: @cryptpad_text_col; } } From bc593132381f3fe0d51bf19ed9a0870929f83bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 9 Dec 2019 11:37:20 +0000 Subject: [PATCH 34/34] lint --- customize.dist/src/less2/include/alertify.less | 4 ++-- customize.dist/src/less2/include/modals-ui-elements.less | 2 +- customize.dist/src/less2/include/usergrid.less | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 96a8ae506..4bd5e298b 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -159,7 +159,7 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; - :last-child{ + :last-child { margin-bottom: 0; } } @@ -520,7 +520,7 @@ overflow-x: auto; } } - // Bootstrap Alerts + // Bootstrap Alerts .alert { margin: 0px 0px @alertify_padding-base 0px; font-size: 12px; diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index 1d91767ba..21707eab8 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -4,7 +4,7 @@ --LessLoader_require: LessLoader_currentFile(); } & { - .cp-spacer{ + .cp-spacer { height: @variables_padding; } // Share modal diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index a171b0950..6ba8c2d07 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -6,7 +6,7 @@ --LessLoader_require: LessLoader_currentFile(); }; & { - + .cp-usergrid-container { margin-bottom: 12px !important; // even when last child of .msg .cp-usergrid-grid {