create share modal in common-ui

pull/1/head
David Benqué 5 years ago
parent ae6f5074a7
commit 598ce5a329

@ -1222,6 +1222,8 @@ define([
pathname: pathname pathname: pathname
}); });
} }
var modal = UI.dialog.tabs(tabs);
common.getAttribute(['general', 'share'], function (err, val) { common.getAttribute(['general', 'share'], function (err, val) {
val = val || {}; val = val || {};
if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { if ((val.edit === false && hashes.viewHash) || !hashes.editHash) {
@ -1246,7 +1248,7 @@ define([
hashes = _hashes; hashes = _hashes;
$(link).find('#cp-share-link-preview').val(getLinkValue()); $(link).find('#cp-share-link-preview').val(getLinkValue());
}); });
return tabs; return modal;
}; };
UIElements.createFileShareModal = function (config) { UIElements.createFileShareModal = function (config) {

@ -2560,7 +2560,6 @@ define([
if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); } if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); }
var friends = common.getFriends(); var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams; 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 ro = folders[id] && folders[id].version >= 2;
var modal = UIElements.createShareModal({ var modal = UIElements.createShareModal({
teamId: APP.team, 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. // can't share the read-only URL and we don't have access to the edit one.
// We should hide the share button. // We should hide the share button.
if (!modal) { return; } if (!modal) { return; }
modal = UI.dialog.tabs(modal);
$shareBlock.click(function () { $shareBlock.click(function () {
UI.openCustomModal(modal, { UI.openCustomModal(modal);
wide: _wide
});
}); });
$container.append($shareBlock); $container.append($shareBlock);
}; };
@ -4054,7 +4050,6 @@ define([
var parsed, modal; var parsed, modal;
var friends = common.getFriends(); var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams; 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 (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder
// if folder is inside SF // if folder is inside SF
@ -4119,7 +4114,6 @@ define([
}; };
modal = padType === 'file' ? UIElements.createFileShareModal(padData) modal = padType === 'file' ? UIElements.createFileShareModal(padData)
: UIElements.createShareModal(padData); : UIElements.createShareModal(padData);
modal = UI.dialog.tabs(modal);
UI.openCustomModal(modal); UI.openCustomModal(modal);
} }
} }

@ -59,7 +59,7 @@ define([
} }
}); });
$('button.cancel').click(); // Close any existing alertify $('button.cancel').click(); // Close any existing alertify
UI.openCustomModal(UI.dialog.tabs(modal)); UI.openCustomModal(modal);
}; };
sframeChan.on('EV_SHARE_REFRESH', function (data) { sframeChan.on('EV_SHARE_REFRESH', function (data) {
createShareDialog(data); createShareDialog(data);

Loading…
Cancel
Save