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