From b5ff5a3b20170e5c14174bf8b4fef78b9ba945ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 10:18:18 +0000 Subject: [PATCH 01/33] open share modal on ready temporary to make working easier --- 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..7dcfafda2 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 () { var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From 874dce748d089469074c508d1ec855700e6916b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 15:30:23 +0000 Subject: [PATCH 02/33] split share modal into 3 tabs --- www/common/common-ui-elements.js | 72 ++++++++++++++++++--------- www/common/translations/messages.json | 8 ++- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index df8836788..706940e90 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1023,6 +1023,7 @@ define([ return div; }; + /// Share Modal Creation UIElements.createShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1031,40 +1032,42 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } + function createAccessRights(group_name) { + var rights = [ + h('label', Messages.share_linkAccess), + h('br'), + UI.createRadio(group_name, 'cp-share-editable-false', + Messages.share_linkView, true, { mark: {tabindex:1} }), + UI.createRadio(group_name, 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + UI.createRadio(group_name, 'cp-share-editable-true', + Messages.share_linkEdit, false, { mark: {tabindex:1} }), + + h('br'), + ]; + return rights; + }; + // Share link tab - var hasFriends = Object.keys(config.friends || {}).length !== 0; - var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; - var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; var content = []; var sfContent = [ h('label', Messages.sharedFolders_share), h('br'), ]; - var shareContent = [ - h('label', Messages.share_linkAccess), - h('br'), - UI.createRadio('cp-share-editable', 'cp-share-editable-true', - Messages.share_linkEdit, true, { mark: {tabindex:1} }), - UI.createRadio('cp-share-editable', 'cp-share-editable-false', - Messages.share_linkView, false, { mark: {tabindex:1} }), - h('br'), - ]; + var linkAccessRights = createAccessRights('link-rights'); var padContent = [ - h('label', Messages.share_linkOptions), - h('br'), UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), - UI.createCheckbox('cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }), h('br'), ]; if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content, shareContent); + Array.prototype.push.apply(content, linkAccessRights); if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); - var mainShareColumn = h('div.cp-share-column.contains-nav', content); - var link = h('div.cp-share-modal' + friendsUIClass); + // XXX remove LESS code for cp-share-columns if not using anymore + //var mainShareColumn = h('div.cp-share-column.contains-nav', content); + var link = h('div.cp-share-modal', content); var saveValue = function () { var edit = Util.isChecked($(link).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); @@ -1075,7 +1078,7 @@ define([ present: present }); }; - onFriendShare.reg(saveValue); + var getLinkValue = function (initValue) { var val = initValue || {}; var edit = val.edit !== undefined ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true')); @@ -1118,9 +1121,8 @@ define([ } var $link = $(link); - $(mainShareColumn).append(UI.dialog.getButtons(shareButtons, config.onClose)).appendTo($link); - $(friendsList).appendTo($link); - + $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); + if (!hashes.editHash) { $(link).find('#cp-share-editable-false').attr('checked', true); $(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); @@ -1139,6 +1141,26 @@ define([ onClose: config.onClose, }); + // Share with contacts tab + + var hasFriends = Object.keys(config.friends || {}).length !== 0; + var onFriendShare = Util.mkEvent(); + var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; + // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; + + onFriendShare.reg(saveValue); + + contactsAccessRights = createAccessRights('contact-rights'); + var contacts = h('.cp-share-modal', contactsAccessRights); + var $contacts = $(contacts); + + $(friendsList).appendTo($contacts); + + var frameContacts = UI.dialog.customModal(contacts, { + buttons: linkButtons, + onClose: config.onClose, + }); + // Embed tab var getEmbedValue = function () { var hash = hashes.viewHash || hashes.editHash; @@ -1148,7 +1170,6 @@ define([ return ''; }; var embed = h('div.cp-share-modal', [ - h('h3', Messages.viewEmbedTitle), h('p', Messages.viewEmbedTag), h('br'), UI.dialog.selectable(getEmbedValue()) @@ -1177,6 +1198,9 @@ define([ var tabs = [{ title: Messages.share_linkCategory, content: frameLink + }, { + title: "Contacts", + content: frameContacts }, { title: Messages.share_embedCategory, content: frameEmbed diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 769f5a52d..0718f666a 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -173,7 +173,6 @@ "viewOpenTitle": "Open this pad in read-only mode in a new tab", "fileShare": "Copy link", "getEmbedCode": "Get embed code", - "viewEmbedTitle": "Embed the pad in an external page", "viewEmbedTag": "To embed this pad, include this iframe in your page wherever you want. You can style it using CSS or HTML attributes.", "fileEmbedTitle": "Embed the file in an external page", "fileEmbedScript": "To embed this file, include this script once in your page to load the Media Tag:", @@ -980,13 +979,12 @@ "properties_passwordWarning": "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.
Press OK to reload and update your access rights.", "properties_passwordSuccess": "The password was successfully changed.
Press OK to reload and update your access rights.", "properties_changePasswordButton": "Submit", - "share_linkCategory": "Share link", + "share_linkCategory": "Link", "share_linkAccess": "Access rights", "share_linkEdit": "Edit", "share_linkView": "View", - "share_linkOptions": "Link options", - "share_linkEmbed": "Embed mode (toolbar and userlist hidden)", - "share_linkPresent": "Present mode (editable sections hidden)", + "share_linkEmbed": "Embed mode (hide toolbar and user list)", + "share_linkPresent": "Present (hide editable sections)", "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", "share_embedCategory": "Embed", From 4f145aed004f33b8a85f367c6dc46efe4aa4c3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 15:31:11 +0000 Subject: [PATCH 03/33] remove wide size for share modal --- www/share/inner.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/www/share/inner.js b/www/share/inner.js index dd6607a45..f8c7fa112 100644 --- a/www/share/inner.js +++ b/www/share/inner.js @@ -59,9 +59,7 @@ define([ } }); $('button.cancel').click(); // Close any existing alertify - UI.openCustomModal(UI.dialog.tabs(modal), { - wide: _wide - }); + UI.openCustomModal(UI.dialog.tabs(modal)); }; sframeChan.on('EV_SHARE_REFRESH', function (data) { createShareDialog(data); From aa743d5c909afd937e8543c6b9034172a10bb2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:24:29 +0000 Subject: [PATCH 04/33] use messages for contacts tab title --- www/common/common-ui-elements.js | 2 +- www/common/translations/messages.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 706940e90..5ee0d0d8d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1199,7 +1199,7 @@ define([ title: Messages.share_linkCategory, content: frameLink }, { - title: "Contacts", + title: Messages.share_contactCategory, content: frameContacts }, { title: Messages.share_embedCategory, diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 0718f666a..8de498439 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -987,6 +987,7 @@ "share_linkPresent": "Present (hide editable sections)", "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", + "share_contactCategory": "Contacts", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From db104d6610cd9e5c7b9d2b13ab3cfcd8aca015fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:28:05 +0000 Subject: [PATCH 05/33] align button array in Link tab --- www/common/common-ui-elements.js | 33 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5ee0d0d8d..43ffbbaf3 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1032,7 +1032,7 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - function createAccessRights(group_name) { + var createAccessRights = function (group_name) { var rights = [ h('label', Messages.share_linkAccess), h('br'), @@ -1049,7 +1049,6 @@ define([ }; // Share link tab - var content = []; var sfContent = [ h('label', Messages.sharedFolders_share), @@ -1090,12 +1089,15 @@ define([ var parsed = Hash.parsePadUrl(href); return origin + parsed.getUrl({embed: embed, present: present}); }; - var linkButtons = [{ + + var cancelButton = { className: 'cancel', name: Messages.cancel, onClick: function () {}, keys: [27] - }]; + }; + + var linkButtons = [cancelButton]; var shareButtons = [{ className: 'primary', name: Messages.share_linkCopy, @@ -1108,8 +1110,8 @@ define([ keys: [13] }]; if (!config.sharedFolder) { - shareButtons.push({ - className: 'primary', + shareButtons.unshift({ + className: 'secondary', // XXX style this diferently than cancel name: Messages.share_linkOpen, onClick: function () { saveValue(); @@ -1121,7 +1123,6 @@ define([ } var $link = $(link); - $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); if (!hashes.editHash) { $(link).find('#cp-share-editable-false').attr('checked', true); @@ -1136,6 +1137,12 @@ define([ $(link).find('#cp-share-link-preview').val(getLinkValue()); }); + // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); + shareButtons.forEach(function(button){ + linkButtons.push(button); + }); + console.log(linkButtons); + var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, onClose: config.onClose, @@ -1156,8 +1163,10 @@ define([ $(friendsList).appendTo($contacts); + var contactButtons = [cancelButton] + var frameContacts = UI.dialog.customModal(contacts, { - buttons: linkButtons, + buttons: contactButtons, onClose: config.onClose, }); @@ -1174,12 +1183,8 @@ define([ h('br'), UI.dialog.selectable(getEmbedValue()) ]); - var embedButtons = [{ - className: 'cancel', - name: Messages.cancel, - onClick: function () {}, - keys: [27] - }, { + var embedButtons = [ + cancelButton, { className: 'primary', name: Messages.share_linkCopy, onClick: function () { From 718fdb556befb99f00363556b5735b7c0d3c30ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:48:37 +0000 Subject: [PATCH 06/33] show message in Contacts tab if user has no contacts --- www/common/common-ui-elements.js | 4 ++-- www/common/translations/messages.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 43ffbbaf3..056e81808 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1152,12 +1152,12 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; + var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : h('p', Messages.share_noContacts); // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; onFriendShare.reg(saveValue); - contactsAccessRights = createAccessRights('contact-rights'); + var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; var contacts = h('.cp-share-modal', contactsAccessRights); var $contacts = $(contacts); diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 8de498439..032a2d87c 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -988,6 +988,7 @@ "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", "share_contactCategory": "Contacts", + "share_noContacts": "You have no friends, learn how to get some. // XXX", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From 33b16ffcdf7d49907f49c875ee7595bf373e6d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 09:47:57 +0000 Subject: [PATCH 07/33] address notes --- www/common/common-ui-elements.js | 47 ++++++++++++++++---------------- www/common/drive-ui.js | 4 +-- www/common/toolbar3.js | 2 +- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 056e81808..fdadce5de 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -877,7 +877,7 @@ define([ return friends[c].curvePublic.slice(0,8); }); - var div = h('div.cp-share-column.contains-nav'); + var div = h('div.contains-nav'); var $div = $(div); // Replace "copy link" by "share with friends" if at least one friend is selected // Also create the "share with friends" button if it doesn't exist @@ -1067,6 +1067,7 @@ define([ // XXX remove LESS code for cp-share-columns if not using anymore //var mainShareColumn = h('div.cp-share-column.contains-nav', content); var link = h('div.cp-share-modal', content); + var saveValue = function () { var edit = Util.isChecked($(link).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); @@ -1090,27 +1091,17 @@ define([ return origin + parsed.getUrl({embed: embed, present: present}); }; - var cancelButton = { - className: 'cancel', + var makeCancelButton = function() { + return {className: 'cancel', name: Messages.cancel, onClick: function () {}, - keys: [27] + keys: [27]}; }; - var linkButtons = [cancelButton]; - var shareButtons = [{ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - saveValue(); - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13] - }]; + var linkButtons = [makeCancelButton()]; + if (!config.sharedFolder) { - shareButtons.unshift({ + linkButtons.push({ className: 'secondary', // XXX style this diferently than cancel name: Messages.share_linkOpen, onClick: function () { @@ -1120,7 +1111,19 @@ define([ }, keys: [[13, 'ctrl']] }); - } + }; + + linkButtons.push({ + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13]} + ); var $link = $(link); @@ -1138,10 +1141,6 @@ define([ }); // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); - shareButtons.forEach(function(button){ - linkButtons.push(button); - }); - console.log(linkButtons); var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, @@ -1163,7 +1162,7 @@ define([ $(friendsList).appendTo($contacts); - var contactButtons = [cancelButton] + var contactButtons = [makeCancelButton()] var frameContacts = UI.dialog.customModal(contacts, { buttons: contactButtons, @@ -1184,7 +1183,7 @@ define([ UI.dialog.selectable(getEmbedValue()) ]); var embedButtons = [ - cancelButton, { + makeCancelButton(), { className: 'primary', name: Messages.share_linkCopy, onClick: function () { diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index b0add7044..ebfe5f106 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4120,9 +4120,7 @@ define([ modal = padType === 'file' ? UIElements.createFileShareModal(padData) : UIElements.createShareModal(padData); modal = UI.dialog.tabs(modal); - UI.openCustomModal(modal, { - wide: _wide - }); + UI.openCustomModal(modal); } } else if ($this.hasClass('cp-app-drive-context-savelocal')) { diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 7dcfafda2..7ec2f54c0 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 () { + $shareBlock.ready(function () { // XXX put .click back when done var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From 96f82c8e7cfd5d38fbf8c917fd6c8ff9f2136f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 11:01:19 +0000 Subject: [PATCH 08/33] fix modal buttons and functions --- www/common/common-ui-elements.js | 110 +++++++++++++++---------------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index fdadce5de..40bb1d4c3 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1032,21 +1032,18 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - var createAccessRights = function (group_name) { - var rights = [ - h('label', Messages.share_linkAccess), - h('br'), - UI.createRadio(group_name, 'cp-share-editable-false', - Messages.share_linkView, true, { mark: {tabindex:1} }), - UI.createRadio(group_name, 'cp-share-present', - Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad - UI.createRadio(group_name, 'cp-share-editable-true', - Messages.share_linkEdit, false, { mark: {tabindex:1} }), - - h('br'), - ]; - return rights; - }; + var rights = h('div', [ + h('label', Messages.share_linkAccess), + h('br'), + UI.createRadio('accessRights', 'cp-share-editable-false', + Messages.share_linkView, true, { mark: {tabindex:1} }), + UI.createRadio('accessRights', 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + UI.createRadio('accessRights', 'cp-share-editable-true', + Messages.share_linkEdit, false, { mark: {tabindex:1} }), + + h('br'), + ]); // Share link tab var content = []; @@ -1054,13 +1051,13 @@ define([ h('label', Messages.sharedFolders_share), h('br'), ]; - var linkAccessRights = createAccessRights('link-rights'); + var padContent = [ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), h('br'), ]; if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content, linkAccessRights); + Array.prototype.push.apply(content); if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); @@ -1069,9 +1066,9 @@ define([ var link = h('div.cp-share-modal', content); var saveValue = function () { - var edit = Util.isChecked($(link).find('#cp-share-editable-true')); + var edit = Util.isChecked($(rights).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); - var present = Util.isChecked($(link).find('#cp-share-present')); + var present = Util.isChecked($(rights).find('#cp-share-present')); common.setAttribute(['general', 'share'], { edit: edit, embed: embed, @@ -1081,10 +1078,9 @@ define([ var getLinkValue = function (initValue) { var val = initValue || {}; - var edit = val.edit !== undefined ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true')); + var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true')); var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed')); - var present = val.present !== undefined ? val.present : Util.isChecked($(link).find('#cp-share-present')); - + var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present')); var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash; var href = origin + pathname + '#' + hash; var parsed = Hash.parsePadUrl(href); @@ -1098,41 +1094,40 @@ define([ keys: [27]}; }; - var linkButtons = [makeCancelButton()]; - - if (!config.sharedFolder) { - linkButtons.push({ - className: 'secondary', // XXX style this diferently than cancel - name: Messages.share_linkOpen, - onClick: function () { - saveValue(); - var v = getLinkValue(); - window.open(v); - }, - keys: [[13, 'ctrl']] - }); - }; + var linkButtons = [ + makeCancelButton(), + !config.sharedFolder && { + className: 'secondary', // XXX style this diferently than cancel + name: Messages.share_linkOpen, + onClick: function () { + saveValue(); + var v = getLinkValue(); + window.open(v); + }, + keys: [[13, 'ctrl']] + }, + { + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13] + } + ]; - linkButtons.push({ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - saveValue(); - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13]} - ); - var $link = $(link); - + // disable edit share options if you don't have edit rights if (!hashes.editHash) { - $(link).find('#cp-share-editable-false').attr('checked', true); - $(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-false').attr('checked', true); + $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); } else if (!hashes.viewHash) { - $(link).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); - $(link).find('#cp-share-editable-true').attr('checked', true); + $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-true').attr('checked', true); } $(link).find('#cp-share-link-preview').val(getLinkValue()); @@ -1156,8 +1151,9 @@ define([ onFriendShare.reg(saveValue); - var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; - var contacts = h('.cp-share-modal', contactsAccessRights); + // XXX Don't display access rights if no contacts + /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; + var contacts = h('div.cp-share-modal'); var $contacts = $(contacts); $(friendsList).appendTo($contacts); @@ -1187,7 +1183,9 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - var v = getEmbedValue(); + var v = getLinkValue({ + embed: true + }); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, From ae6f5074a7bd6fa64433cf38fd49d63879a31c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 11:27:47 +0000 Subject: [PATCH 09/33] align button to share with contacts split the output of createShareWithFriends in content and button --- www/common/common-ui-elements.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 40bb1d4c3..5767ad35e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -932,7 +932,7 @@ define([ }, refreshButtons); $div.append(teamsList.div); - var shareButtons = [{ + var shareButton = { className: 'primary cp-share-with-friends', name: Messages.share_withFriends, onClick: function () { @@ -992,7 +992,7 @@ define([ } }, keys: [13] - }]; + }; common.getAttribute(['general', 'share-friends'], function (err, val) { order = val || []; @@ -1017,10 +1017,12 @@ define([ // Display them $(friendDiv).find('.cp-usergrid-grid').detach(); $(friendDiv).append(h('div.cp-usergrid-grid', others)); - $div.append(UI.dialog.getButtons(shareButtons, config.onClose)); refreshButtons(); }); - return div; + return { + content: div, + button: shareButton + }; }; /// Share Modal Creation @@ -1146,11 +1148,16 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : h('p', Messages.share_noContacts); - // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; + var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { + content: h('p', Messages.share_noContacts) + }; + var friendsList = friendsObject.content; + onFriendShare.reg(saveValue); + + // XXX Don't display access rights if no contacts /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; var contacts = h('div.cp-share-modal'); @@ -1158,7 +1165,8 @@ define([ $(friendsList).appendTo($contacts); - var contactButtons = [makeCancelButton()] + var contactButtons = [makeCancelButton(), + friendsObject.button]; var frameContacts = UI.dialog.customModal(contacts, { buttons: contactButtons, @@ -1240,6 +1248,7 @@ define([ }); return tabs; }; + UIElements.createFileShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1338,6 +1347,7 @@ define([ return tabs; }; + UIElements.createInviteTeamModal = function (config) { var common = config.common; var hasFriends = Object.keys(config.friends || {}).length !== 0; From 598ce5a32918d88e98ca7a7a8bc618a3b6d51daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 13:11:38 +0000 Subject: [PATCH 10/33] create share modal in common-ui --- www/common/common-ui-elements.js | 4 +++- www/common/drive-ui.js | 8 +------- www/share/inner.js | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5767ad35e..9296bb747 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1222,6 +1222,8 @@ define([ pathname: pathname }); } + + var modal = UI.dialog.tabs(tabs); common.getAttribute(['general', 'share'], function (err, val) { val = val || {}; if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { @@ -1246,7 +1248,7 @@ define([ hashes = _hashes; $(link).find('#cp-share-link-preview').val(getLinkValue()); }); - return tabs; + return modal; }; UIElements.createFileShareModal = function (config) { diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index ebfe5f106..6b764e7a5 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2560,7 +2560,6 @@ define([ if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); } var friends = common.getFriends(); var teams = common.getMetadataMgr().getPrivateData().teams; - var _wide = Object.keys(friends).length || Object.keys(teams).length; var ro = folders[id] && folders[id].version >= 2; var modal = UIElements.createShareModal({ teamId: APP.team, @@ -2580,11 +2579,8 @@ define([ // can't share the read-only URL and we don't have access to the edit one. // We should hide the share button. if (!modal) { return; } - modal = UI.dialog.tabs(modal); $shareBlock.click(function () { - UI.openCustomModal(modal, { - wide: _wide - }); + UI.openCustomModal(modal); }); $container.append($shareBlock); }; @@ -4054,7 +4050,6 @@ define([ var parsed, modal; var friends = common.getFriends(); var teams = common.getMetadataMgr().getPrivateData().teams; - var _wide = Object.keys(friends).length || Object.keys(teams).length; if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder // if folder is inside SF @@ -4119,7 +4114,6 @@ define([ }; modal = padType === 'file' ? UIElements.createFileShareModal(padData) : UIElements.createShareModal(padData); - modal = UI.dialog.tabs(modal); UI.openCustomModal(modal); } } diff --git a/www/share/inner.js b/www/share/inner.js index f8c7fa112..d5e7428c8 100644 --- a/www/share/inner.js +++ b/www/share/inner.js @@ -59,7 +59,7 @@ define([ } }); $('button.cancel').click(); // Close any existing alertify - UI.openCustomModal(UI.dialog.tabs(modal)); + UI.openCustomModal(modal); }; sframeChan.on('EV_SHARE_REFRESH', function (data) { createShareDialog(data); From b8753f1fd7226c9ea3623421ceef23e5a2db2dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 13:14:25 +0000 Subject: [PATCH 11/33] clean up share modal - share access rights buttons between all tabs - handle present mode when available - general clean up of code to be more readable --- www/common/common-ui-elements.js | 135 +++++++++++++------------- www/common/translations/messages.json | 2 +- 2 files changed, 68 insertions(+), 69 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 9296bb747..b501f5cd4 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1034,46 +1034,28 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - var rights = h('div', [ + var parsed = Hash.parsePadUrl(pathname); + var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; + + var rights = h('div.msg', [ h('label', Messages.share_linkAccess), h('br'), UI.createRadio('accessRights', 'cp-share-editable-false', Messages.share_linkView, true, { mark: {tabindex:1} }), - UI.createRadio('accessRights', 'cp-share-present', - Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + canPresent ? UI.createRadio('accessRights', 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }) : undefined, UI.createRadio('accessRights', 'cp-share-editable-true', Messages.share_linkEdit, false, { mark: {tabindex:1} }), h('br'), ]); - // Share link tab - var content = []; - var sfContent = [ - h('label', Messages.sharedFolders_share), - h('br'), - ]; - - var padContent = [ - UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), - h('br'), - ]; - if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content); - if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } - content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); - - // XXX remove LESS code for cp-share-columns if not using anymore - //var mainShareColumn = h('div.cp-share-column.contains-nav', content); - var link = h('div.cp-share-modal', content); var saveValue = function () { var edit = Util.isChecked($(rights).find('#cp-share-editable-true')); - var embed = Util.isChecked($(link).find('#cp-share-embed')); var present = Util.isChecked($(rights).find('#cp-share-present')); common.setAttribute(['general', 'share'], { edit: edit, - embed: embed, present: present }); }; @@ -1081,7 +1063,7 @@ define([ var getLinkValue = function (initValue) { var val = initValue || {}; var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true')); - var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed')); + var embed = val.embed; var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present')); var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash; var href = origin + pathname + '#' + hash; @@ -1096,6 +1078,18 @@ define([ keys: [27]}; }; + // Share link tab + var linkContent = config.sharedFolder ? [ + h('label', Messages.sharedFolders_share), + h('br'), + ] : [ + UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), + h('br'), + ]; + linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); + + var link = h('div.cp-share-modal', linkContent); + var linkButtons = [ makeCancelButton(), !config.sharedFolder && { @@ -1103,7 +1097,9 @@ define([ name: Messages.share_linkOpen, onClick: function () { saveValue(); - var v = getLinkValue(); + var v = getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + }); window.open(v); }, keys: [[13, 'ctrl']] @@ -1113,7 +1109,9 @@ define([ name: Messages.share_linkCopy, onClick: function () { saveValue(); - var v = getLinkValue(); + var v = getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + }); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, @@ -1121,23 +1119,14 @@ define([ } ]; - - // disable edit share options if you don't have edit rights - if (!hashes.editHash) { - $(rights).find('#cp-share-editable-false').attr('checked', true); - $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); - } else if (!hashes.viewHash) { - $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); - $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); - $(rights).find('#cp-share-editable-true').attr('checked', true); - } - + // update values for link preview when radio btns change $(link).find('#cp-share-link-preview').val(getLinkValue()); - $(link).find('input[type="radio"], input[type="checkbox"]').on('change', function () { + $(rights).find('input[type="radio"]').on('change', function () { + $(link).find('#cp-share-link-preview').val(getLinkValue()); + }); + $(link).find('input[type="checkbox"]').on('change', function () { $(link).find('#cp-share-link-preview').val(getLinkValue()); }); - - // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, @@ -1149,39 +1138,34 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { - content: h('p', Messages.share_noContacts) + content: h('p', Messages.share_noContacts), + button: {} }; var friendsList = friendsObject.content; - onFriendShare.reg(saveValue); - - // XXX Don't display access rights if no contacts /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; - var contacts = h('div.cp-share-modal'); - var $contacts = $(contacts); - - $(friendsList).appendTo($contacts); + var contactsContent = h('div.cp-share-modal'); + $(contactsContent).append(friendsList); var contactButtons = [makeCancelButton(), friendsObject.button]; - var frameContacts = UI.dialog.customModal(contacts, { + var frameContacts = UI.dialog.customModal(contactsContent, { buttons: contactButtons, onClose: config.onClose, }); // Embed tab var getEmbedValue = function () { - var hash = hashes.viewHash || hashes.editHash; - var href = origin + pathname + '#' + hash; - var parsed = Hash.parsePadUrl(href); - var url = origin + parsed.getUrl({embed: true, present: true}); + var url = getLinkValue({ + embed: true + }); return ''; }; - var embed = h('div.cp-share-modal', [ + var embedContent = h('div.cp-share-modal', [ h('p', Messages.viewEmbedTag), h('br'), UI.dialog.selectable(getEmbedValue()) @@ -1191,15 +1175,13 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - var v = getLinkValue({ - embed: true - }); + var v = getEmbedValue(); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, keys: [13] }]; - var frameEmbed = UI.dialog.customModal(embed, { + var frameEmbed = UI.dialog.customModal(embedContent, { buttons: embedButtons, onClose: config.onClose, }); @@ -1224,19 +1206,36 @@ define([ } var modal = UI.dialog.tabs(tabs); + $(modal).find('.alertify-tabs-titles').after(rights); + + // XXX + // disable edit share options if you don't have edit rights + if (!hashes.editHash) { + $(rights).find('#cp-share-editable-false').attr('checked', true); + $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); + } else if (!hashes.viewHash) { + $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-true').attr('checked', true); + } + common.getAttribute(['general', 'share'], function (err, val) { val = val || {}; - if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { - $(link).find('#cp-share-editable-false').prop('checked', true); - $(link).find('#cp-share-editable-true').prop('checked', false); + if (val.present && canPresent) { + $(rights).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-editable-true').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', true); + } else if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { + $(rights).find('#cp-share-editable-false').prop('checked', true); + $(rights).find('#cp-share-editable-true').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', false); } else { - $(link).find('#cp-share-editable-true').prop('checked', true); - $(link).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-editable-true').prop('checked', true); + $(rights).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', false); } - if (val.embed) { $(link).find('#cp-share-embed').prop('checked', true); } - if (val.present) { $(link).find('#cp-share-present').prop('checked', true); } - if (config.sharedFolder) { - delete val.embed; + delete val.embed; + if (!canPresent) { delete val.present; } $(link).find('#cp-share-link-preview').val(getLinkValue(val)); diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 032a2d87c..6751fa8c3 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1002,7 +1002,7 @@ "sharedFolders_create_name": "Folder name", "sharedFolders_create_owned": "Owned folder", "sharedFolders_create_password": "Folder password", - "sharedFolders_share": "Share this URL with other registered users to give them access to the shared folder. Once they open this URL, the shared folder will be added to the root directory of their CryptDrive.", + "sharedFolders_share": "Share this URL with other registered users to give them access to the shared folder. Once they open this URL, the shared folder will be added to the root directory of their CryptDrive. // XXX change/delete?", "convertFolderToSF_SFParent": "This folder cannot be converted to a shared folder in its current location. Move it outside of the containing shared folder to continue.", "convertFolderToSF_SFChildren": "This folder cannot be converted to a shared folder because it already contains shared folders. Move those Shared folders elsewhere to continue.", "convertFolderToSF_confirm": "This folder must be converted to a Shared folder for others to view it. Continue?", From 8d46bbf3b492b3a031f5a50bc6bfe7e2cf86db54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 15:39:33 +0000 Subject: [PATCH 12/33] update link preview in embed tab --- www/common/common-ui-elements.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index b501f5cd4..ab435d1e8 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1165,11 +1165,11 @@ define([ }); return ''; }; - var embedContent = h('div.cp-share-modal', [ + var embedContent = [ h('p', Messages.viewEmbedTag), h('br'), - UI.dialog.selectable(getEmbedValue()) - ]); + UI.dialog.selectable(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1 }) + ]; var embedButtons = [ makeCancelButton(), { className: 'primary', @@ -1181,7 +1181,16 @@ define([ }, keys: [13] }]; - var frameEmbed = UI.dialog.customModal(embedContent, { + + var embed = h('div.cp-share-modal', embedContent); + + // update values for link preview when radio btns change + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + $(rights).find('input[type="radio"]').on('change', function () { + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + }); + + var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons, onClose: config.onClose, }); From 13246d64cefd26e010c1d649f035d468c5aee4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 15:57:30 +0000 Subject: [PATCH 13/33] get link from ShareWithFriends --- www/common/common-ui-elements.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ab435d1e8..88beb0109 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -864,7 +864,7 @@ define([ }; - var createShareWithFriends = function (config, onShare) { + var createShareWithFriends = function (config, onShare, linkGetter) { var common = config.common; var sframeChan = common.getSframeChannel(); var title = config.title; @@ -936,7 +936,8 @@ define([ className: 'primary cp-share-with-friends', name: Messages.share_withFriends, onClick: function () { - var href = Hash.getRelativeHref($('#cp-share-link-preview').val()); + var href = Hash.getRelativeHref(linkGetter()); + console.log(href); var $friends = $div.find('.cp-usergrid-user.cp-selected'); $friends.each(function (i, el) { var curve = $(el).attr('data-curve'); @@ -1025,7 +1026,7 @@ define([ }; }; - /// Share Modal Creation + /// Share Modal Creation XXX remove this flag UIElements.createShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1137,7 +1138,7 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { + var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare, getLinkValue) : { content: h('p', Messages.share_noContacts), button: {} }; From 682b8e4361a8a16ce7ec8a499fdfa080938984a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 16:47:06 +0000 Subject: [PATCH 14/33] refactor file share modal --- www/common/common-ui-elements.js | 84 ++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 88beb0109..9c96d84e9 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1270,49 +1270,65 @@ define([ if (!hashes.fileHash) { throw new Error("You must provide a file hash"); } var url = origin + pathname + '#' + hashes.fileHash; - - // Share link tab - var hasFriends = Object.keys(config.friends || {}).length !== 0; - var friendsList = hasFriends ? createShareWithFriends(config) : undefined; - var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; - var mainShareColumn = h('div.cp-share-column.contains-nav', [ - h('div.cp-share-column', [ - hasFriends ? h('p', Messages.share_description) : undefined, - UI.dialog.selectable('', { id: 'cp-share-link-preview' }), - ]), - ]); - var link = h('div.cp-share-modal' + friendsUIClass); var getLinkValue = function () { return url; }; - $(mainShareColumn).find('#cp-share-link-preview').val(getLinkValue()); - var linkButtons = [{ - className: 'cancel', + + var makeCancelButton = function() { + return {className: 'cancel', name: Messages.cancel, onClick: function () {}, - keys: [27] - }]; - var shareButtons = [{ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13] - }]; + keys: [27]}; + }; - var $link = $(link); - $(mainShareColumn).append(UI.dialog.getButtons(shareButtons, config.onClose)).appendTo($link); - $(friendsList).appendTo($link); + // Share link tab + var linkContent = [ + UI.dialog.selectable(getLinkValue(), { id: 'cp-share-link-preview', tabindex: 1 }) + ]; + + var link = h('div.cp-share-modal', linkContent); + + var linkButtons = [ + makeCancelButton(), + { + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13] + } + ]; var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, onClose: config.onClose, }); + // share with contacts tab + var hasFriends = Object.keys(config.friends || {}).length !== 0; + + var friendsObject = hasFriends ? createShareWithFriends(config, null, getLinkValue) : { + content: h('p', Messages.share_noContacts), + button: {} + }; + var friendsList = friendsObject.content; + + var contactsContent = h('div.cp-share-modal'); + $(contactsContent).append(friendsList); + + var contactButtons = [makeCancelButton(), + friendsObject.button]; + + var frameContacts = UI.dialog.customModal(contactsContent, { + buttons: contactButtons, + onClose: config.onClose, + }); + + // Embed tab var embed = h('div.cp-share-modal', [ - h('h3', Messages.fileEmbedTitle), h('p', Messages.fileEmbedScript), h('br'), UI.dialog.selectable(common.getMediatagScript()), @@ -1344,6 +1360,9 @@ define([ var tabs = [{ title: Messages.share_linkCategory, content: frameLink + }, { + title: Messages.share_contactCategory, + content: frameContacts }, { title: Messages.share_embedCategory, content: frameEmbed @@ -1355,7 +1374,8 @@ define([ pathname: pathname }); } - return tabs; + var modal = UI.dialog.tabs(tabs); + return modal; }; From 339030a84ebbe28b85fe56c9c439f22e8d68237c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 17:03:16 +0000 Subject: [PATCH 15/33] bug fixes --- www/common/common-ui-elements.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 9c96d84e9..3c2fa3785 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1123,10 +1123,14 @@ define([ // update values for link preview when radio btns change $(link).find('#cp-share-link-preview').val(getLinkValue()); $(rights).find('input[type="radio"]').on('change', function () { - $(link).find('#cp-share-link-preview').val(getLinkValue()); + $(link).find('#cp-share-link-preview').val(getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + })); }); $(link).find('input[type="checkbox"]').on('change', function () { - $(link).find('#cp-share-link-preview').val(getLinkValue()); + $(link).find('#cp-share-link-preview').val(getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + })); }); var frameLink = UI.dialog.customModal(link, { @@ -1292,7 +1296,6 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - saveValue(); var v = getLinkValue(); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } From d38f5a16c2c6a8f21f6913a609758b08f17d303b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 10:26:30 +0000 Subject: [PATCH 16/33] add optional icon to modal tabs --- www/common/common-interface.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 72851a8cc..6cb4f4554 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -191,6 +191,10 @@ define([ if (!tab.content || !tab.title) { return; } var content = h('div.alertify-tabs-content', tab.content); var title = h('span.alertify-tabs-title', tab.title); + if (tab.icon) { + var icon = h('i', {class: 'fa ' + tab.icon}); + $(title).prepend(' ').prepend(icon); + }; $(title).click(function () { titles.forEach(function (t) { $(t).removeClass('alertify-tabs-active'); }); contents.forEach(function (c) { $(c).removeClass('alertify-tabs-content-active'); }); From 8a11cf9b3857438fdc871b02bafdc25ff2239b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 12:29:23 +0000 Subject: [PATCH 17/33] style share modal --- .../src/less2/include/alertify.less | 24 ++++++++++++++----- .../src/less2/include/colortheme.less | 2 +- www/common/common-ui-elements.js | 12 ++++++---- www/common/translations/messages.json | 8 +++---- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 142cc2509..a98572939 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -17,13 +17,14 @@ @alertify-btn-fg: @alertify-fore; + @alertify-light-bg: fade(@alertify-fore, 25%); @alertify-bg: @colortheme_modal-dim; @alertify-fg: @alertify-fore; @alertify-input-bg: @colortheme_modal-input; @alertify-input-fg: @colortheme_modal-input-fg; - @alertify_padding-base: @variables_padding; + @alertify_padding-base: 8px; // XXX to align tab contents with buttons. could change @variables-padding: 12px @alertify_box-shadow: @variables_shadow; // Logs to show that something has happened @@ -158,33 +159,44 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; + &.access-rights{ + .radio-group{ + display: flex; + flex-direction: row; + .cp-radio{ + margin-right: 30px; + } + } + } } .alertify-tabs { max-height: 100%; display: flex; flex-flow: column; .alertify-tabs-titles { - height: 30px; + height: 40px; display: flex; border-bottom: 1px solid @alertify-fore; - margin-bottom: 20px; + margin-bottom: 10px; box-sizing: content-box; span { font-size: 20px; - height: 30px; - line-height: 30px; + height: 40px; + line-height: 40px; box-sizing: border-box; padding: 0 15px; border-left: 1px solid lighten(@alertify-base, 10%); border-right: 1px solid lighten(@alertify-base, 10%); cursor: pointer; + &:hover { + background-color: @alertify-light-bg; + } } span.alertify-tabs-active { background-color: @alertify-fore; border-left: 1px solid @alertify-fore; border-right: 1px solid @alertify-fore; color: @alertify-base; - font-weight: bold; cursor: default; } } diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 44719c2d6..2e0c6371c 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -23,7 +23,7 @@ @colortheme_form-bg: @colortheme_logo-2; @colortheme_form-color: #ffffff; @colortheme_form-bg-alt: #ffffff; -@colortheme_form-color-alt: @colortheme_logo-1; +@colortheme_form-color-alt: @colortheme_logo-2; @colortheme_form-warning: #f49842; @colortheme_form-warning-hov: darken(@colortheme_form-warning, 5%); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 3c2fa3785..0931980c2 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -899,7 +899,7 @@ define([ delete friends[curve]; }); - var friendsList = UIElements.getUserGrid(Messages.share_linkFriends, { + var friendsList = UIElements.getUserGrid(null, { common: common, data: friends, noFilter: false @@ -1038,17 +1038,16 @@ define([ var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; - var rights = h('div.msg', [ + var rights = h('div.msg.access-rights', [ 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} }), canPresent ? UI.createRadio('accessRights', 'cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }) : undefined, UI.createRadio('accessRights', 'cp-share-editable-true', - Messages.share_linkEdit, false, { mark: {tabindex:1} }), - - h('br'), + Messages.share_linkEdit, false, { mark: {tabindex:1} })]) ]); @@ -1203,12 +1202,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, + icon: "fa-link", content: frameLink }, { title: Messages.share_contactCategory, + icon: "fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, + icon: "fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 6751fa8c3..83a64842a 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -984,11 +984,11 @@ "share_linkEdit": "Edit", "share_linkView": "View", "share_linkEmbed": "Embed mode (hide toolbar and user list)", - "share_linkPresent": "Present (hide editable sections)", - "share_linkOpen": "Open in new tab", - "share_linkCopy": "Copy to clipboard", + "share_linkPresent": "Present", + "share_linkOpen": "Preview", + "share_linkCopy": "Copy", "share_contactCategory": "Contacts", - "share_noContacts": "You have no friends, learn how to get some. // XXX", + "share_noContacts": "You do not have any contacts yet. // XXX", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From fae0a930e3b3c12e2dcf1e157a4d518c7423cc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 13:03:40 +0000 Subject: [PATCH 18/33] tab icons correction --- www/common/common-interface.js | 2 +- www/common/common-ui-elements.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 6cb4f4554..5eff5edcf 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -192,7 +192,7 @@ define([ var content = h('div.alertify-tabs-content', tab.content); var title = h('span.alertify-tabs-title', tab.title); if (tab.icon) { - var icon = h('i', {class: 'fa ' + tab.icon}); + var icon = h('i', {class: tab.icon}); $(title).prepend(' ').prepend(icon); }; $(title).click(function () { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 0931980c2..2fe470d5e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1202,15 +1202,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, - icon: "fa-link", + icon: "fa fa-link", content: frameLink }, { title: Messages.share_contactCategory, - icon: "fa-address-book", + icon: "fa fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, - icon: "fa-code", + icon: "fa fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { From 9f3aa25fdd6d44430ba3d49201df35fe96052a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 13:50:46 +0000 Subject: [PATCH 19/33] move modal styles to new file --- customize.dist/src/less2/include/alertify.less | 9 --------- .../src/less2/include/framework.less | 2 ++ .../src/less2/include/modals-ui-elements.less | 18 ++++++++++++++++++ www/common/common-ui-elements.js | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 customize.dist/src/less2/include/modals-ui-elements.less diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index a98572939..e9cd38ca1 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -159,15 +159,6 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; - &.access-rights{ - .radio-group{ - display: flex; - flex-direction: row; - .cp-radio{ - margin-right: 30px; - } - } - } } .alertify-tabs { max-height: 100%; diff --git a/customize.dist/src/less2/include/framework.less b/customize.dist/src/less2/include/framework.less index 685bfcaf5..57cd84b0b 100644 --- a/customize.dist/src/less2/include/framework.less +++ b/customize.dist/src/less2/include/framework.less @@ -15,6 +15,7 @@ @import (reference) "./messenger.less"; @import (reference) "./cursor.less"; @import (reference) "./usergrid.less"; +@import (reference) "./modals-ui-elements.less"; .framework_main(@bg-color, @warn-color, @color) { --LessLoader_require: LessLoader_currentFile(); @@ -32,6 +33,7 @@ @color: @color ); .alertify_main(); + .modals-ui-elements_main(); .corner_main(); .contextmenu_main(); .fileupload_main(); diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less new file mode 100644 index 000000000..f173ae8d5 --- /dev/null +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -0,0 +1,18 @@ +@import (reference) "./colortheme-all.less"; + +.modals-ui-elements_main() { + --LessLoader_require: LessLoader_currentFile(); +}; +& { + // Share modal + .cp-inline-radio-group{ + .radio-group{ + display: flex; + flex-direction: row; + .cp-radio{ + margin-right: 30px; + } + } + } + +} \ No newline at end of file diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 2fe470d5e..e9863d030 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1038,7 +1038,7 @@ define([ var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; - var rights = h('div.msg.access-rights', [ + var rights = h('div.msg.cp-inline-radio-group', [ h('label', Messages.share_linkAccess), h('br'), h('div.radio-group',[ From 2a23359d8fee02f9fa651c30f5851c7477d73025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 14:31:57 +0000 Subject: [PATCH 20/33] fix import of modals-ui-elements --- customize.dist/src/less2/include/framework.less | 1 + customize.dist/src/less2/include/modals-ui-elements.less | 4 ++-- www/share/app-share.less | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/framework.less b/customize.dist/src/less2/include/framework.less index 57cd84b0b..0eefababb 100644 --- a/customize.dist/src/less2/include/framework.less +++ b/customize.dist/src/less2/include/framework.less @@ -72,6 +72,7 @@ ); .fileupload_main(); .alertify_main(); + .modals-ui-elements_main(); .corner_main(); .contextmenu_main(); .tippy_main(); diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index f173ae8d5..a3cc41004 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -2,10 +2,10 @@ .modals-ui-elements_main() { --LessLoader_require: LessLoader_currentFile(); -}; +} & { // Share modal - .cp-inline-radio-group{ + .msg.cp-inline-radio-group{ .radio-group{ display: flex; flex-direction: row; diff --git a/www/share/app-share.less b/www/share/app-share.less index cab03b7ce..8efdd17f3 100644 --- a/www/share/app-share.less +++ b/www/share/app-share.less @@ -4,10 +4,12 @@ @import (reference) '../../customize/src/less2/include/checkmark.less'; @import (reference) '../../customize/src/less2/include/password-input.less'; @import (reference) '../../customize/src/less2/include/usergrid.less'; +@import (reference) '../../customize/src/less2/include/modals-ui-elements.less'; &.cp-app-share { .tippy_main(); .alertify_main(); + .modals-ui-elements_main(); .checkmark_main(20px); .password_main(); .modal_main(); From cc5d6260dcbce8a2c703b5b0069710748aad7609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:09:38 +0000 Subject: [PATCH 21/33] re-align buttons and modal content --- .../src/less2/include/alertify.less | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index e9cd38ca1..91e75fe17 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -24,7 +24,7 @@ @alertify-input-bg: @colortheme_modal-input; @alertify-input-fg: @colortheme_modal-input-fg; - @alertify_padding-base: 8px; // XXX to align tab contents with buttons. could change @variables-padding: 12px + @alertify_padding-base: @variables_padding; // XXX to align tab contents with buttons. could change @variables-padding: 12px @alertify_box-shadow: @variables_shadow; // Logs to show that something has happened @@ -219,10 +219,9 @@ color: darken(@alertify-input-fg, 15%); } input:not(.form-control), textarea { - background-color: @alertify-input-bg; - color: @alertify-input-fg; - border: 0px; - + background-color: @alertify-input-fg; + color: @alertify-input-bg; + border: 1px solid @alertify-input-bg; margin-bottom: 15px; width: 100%; font-size: 100%; @@ -242,6 +241,7 @@ } } + input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; @@ -264,7 +264,7 @@ display: inline-block; align-items: center; padding: 0 6px; - margin: 6px 8px; + //margin: 6px 8px; line-height: 36px; min-height: 36px; white-space: nowrap; @@ -340,12 +340,15 @@ } } - button.btn { - margin: 6px 4px; - } - nav { + padding: @alertify_padding-base; text-align: right; + button{ + margin:0px; + &:not(:last-child) { + margin-right: @alertify_padding-base; + } + } } } } From 6a663c5d353933636ba29cb899b2a75fb01f02c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:16:25 +0000 Subject: [PATCH 22/33] re-re-align buttons --- customize.dist/src/less2/include/alertify.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 91e75fe17..e4e1d24d6 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -264,7 +264,7 @@ display: inline-block; align-items: center; padding: 0 6px; - //margin: 6px 8px; + margin: 6px 8px; line-height: 36px; min-height: 36px; white-space: nowrap; @@ -344,9 +344,9 @@ padding: @alertify_padding-base; text-align: right; button{ - margin:0px; + margin:0px !important; // XXX was not overriding the button margin &:not(:last-child) { - margin-right: @alertify_padding-base; + margin-right: @alertify_padding-base !important; } } } From 8cfc108276b7ffca86d3f1b2ec71523b795b33d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:33:15 +0000 Subject: [PATCH 23/33] text input styling differentiate between input and readonly --- customize.dist/src/less2/include/alertify.less | 11 ++++++++--- customize.dist/src/less2/include/usergrid.less | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index e4e1d24d6..a2418f05a 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -209,14 +209,14 @@ } ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; opacity: 1; /* Firefox */ } :-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; } ::-ms-input-placeholder { /* Microsoft Edge */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; } input:not(.form-control), textarea { background-color: @alertify-input-fg; @@ -226,6 +226,11 @@ width: 100%; font-size: 100%; padding: @alertify_padding-base; + &[readonly="readonly"]{ + background-color: @alertify-light-bg; + color: @cryptpad_text_col; + border-color: @alertify-input-fg; + } } span.cp-password-container { diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index a2d2c8fc5..38202de86 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -24,7 +24,7 @@ min-width: 0; margin-bottom: 0 !important; &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: @colortheme_alertify-primary-text; + color: @cryptpad_color_grey; opacity: 1; /* Firefox */ } } From c4f84b9ee962b7166a0a001671cd2dba5f36094c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:39:23 +0000 Subject: [PATCH 24/33] add icons to filesharemodal tabs --- www/common/common-ui-elements.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index e9863d030..1512cb761 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1364,12 +1364,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, + icon: "fa fa-link", content: frameLink }, { title: Messages.share_contactCategory, + icon: "fa fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, + icon: "fa fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { From 730c4e02cf47313be12e07d206d38236f61d858f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 16:37:06 +0000 Subject: [PATCH 25/33] re-enable click to open share modal --- 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 7ec2f54c0..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 put .click back when done + $shareBlock.click(function () { var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From dfcf6d71557f63e8830bc30aa2b495798dfacf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 17:07:38 +0000 Subject: [PATCH 26/33] remove text fields in properties modal --- .../src/less2/include/modals-ui-elements.less | 9 ++++++ www/common/common-ui-elements.js | 28 ++++--------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index a3cc41004..86074f4ad 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -15,4 +15,13 @@ } } + // Properties modal + .cp-app-prop{ + margin-bottom: 10px; + } + + .cp-app-prop-content{ + color: @cryptpad_text_col; + } + } \ No newline at end of file diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 1512cb761..089e10880 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -684,26 +684,15 @@ define([ } if (data.tags && Array.isArray(data.tags)) { - $('