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);
}); });
if (!manager.isInSharedFolder(currentPath)) {
$block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder') $block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder')
.click(function () { .click(function () {
addSharedFolderModal(function (obj) { addSharedFolderModal(function (obj) {
manager.addSharedFolder(currentPath, obj, refresh); 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
}); });
if (!manager.isInSharedFolder(currentPath)) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-shared-folder'}, attributes: {'class': 'cp-app-drive-new-shared-folder'},
content: $('<div>').append($folderIcon.clone()).html() + "NEW SF" // XXX 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
if (!manager.isInSharedFolder(currentPath)) {
var $element3 = $('<li>', { var $element3 = $('<li>', {
'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' + 'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' +
'cp-app-drive-element-grid' 'cp-app-drive-element-grid'
}).prepend($folderIcon.clone()).appendTo($container); }).prepend($folderIcon.clone()).appendTo($container);
$element3.append($('<span>', { 'class': 'cp-app-drive-new-name' }) $element3.append($('<span>', { 'class': 'cp-app-drive-new-name' })
.text("SF")); // XXX .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