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] 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) || "";