Hide shared folder creation links when inside a shared folder

pull/1/head
yflory 6 years ago
parent c9ac3c7c2b
commit b4c294565e

@ -792,9 +792,13 @@ define([
var filter; var filter;
if (type === "content") { if (type === "content") {
// Return true in filter to hide
filter = function ($el, className) { filter = function ($el, className) {
if (className === 'newfolder') { return; } if (className === 'newfolder') { return; }
if (className === 'newsharedfolder') { return; } if (className === 'newsharedfolder') {
// Hide the new shared folder menu if we're already in a shared folder
return manager.isInSharedFolder(currentPath);
}
return AppConfig.availablePadTypes.indexOf($el.attr('data-type')) === -1; return AppConfig.availablePadTypes.indexOf($el.attr('data-type')) === -1;
}; };
} else { } else {
@ -1766,12 +1770,14 @@ define([
.click(function () { .click(function () {
manager.addFolder(currentPath, null, onCreated); manager.addFolder(currentPath, null, onCreated);
}); });
$block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder') if (!manager.isInSharedFolder(currentPath)) {
.click(function () { $block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder')
addSharedFolderModal(function (obj) { .click(function () {
manager.addSharedFolder(currentPath, obj, refresh); addSharedFolderModal(function (obj) {
manager.addSharedFolder(currentPath, obj, refresh);
});
}); });
}); }
$block.find('a.cp-app-drive-new-upload, li.cp-app-drive-new-upload') $block.find('a.cp-app-drive-new-upload, li.cp-app-drive-new-upload')
.click(function () { .click(function () {
var $input = $('<input>', { var $input = $('<input>', {
@ -1811,11 +1817,13 @@ define([
attributes: {'class': 'cp-app-drive-new-folder'}, attributes: {'class': 'cp-app-drive-new-folder'},
content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder
}); });
options.push({ if (!manager.isInSharedFolder(currentPath)) {
tag: 'a', options.push({
attributes: {'class': 'cp-app-drive-new-shared-folder'}, tag: 'a',
content: $('<div>').append($folderIcon.clone()).html() + "NEW SF" // XXX attributes: {'class': 'cp-app-drive-new-shared-folder'},
}); content: $('<div>').append($folderIcon.clone()).html() + "NEW SF" // XXX
});
}
options.push({tag: 'hr'}); options.push({tag: 'hr'});
options.push({ options.push({
tag: 'a', tag: 'a',
@ -2065,12 +2073,14 @@ define([
$element1.append($('<span>', { 'class': 'cp-app-drive-new-name' }) $element1.append($('<span>', { 'class': 'cp-app-drive-new-name' })
.text(Messages.fm_folder)); .text(Messages.fm_folder));
// Shared Folder // Shared Folder
var $element3 = $('<li>', { if (!manager.isInSharedFolder(currentPath)) {
'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' + var $element3 = $('<li>', {
'cp-app-drive-element-grid' 'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' +
}).prepend($folderIcon.clone()).appendTo($container); 'cp-app-drive-element-grid'
$element3.append($('<span>', { 'class': 'cp-app-drive-new-name' }) }).prepend($folderIcon.clone()).appendTo($container);
.text("SF")); // XXX $element3.append($('<span>', { 'class': 'cp-app-drive-new-name' })
.text("SF")); // XXX
}
// File // File
var $element2 = $('<li>', { var $element2 = $('<li>', {
'class': 'cp-app-drive-new-upload cp-app-drive-element-row ' + 'class': 'cp-app-drive-new-upload cp-app-drive-element-row ' +

Loading…
Cancel
Save