Add dummy download folders and pads

pull/1/head
ClemDee 5 years ago
parent b49777cd37
commit 043808d9db

@ -8,6 +8,7 @@ define([
'/common/common-interface.js', '/common/common-interface.js',
'/common/common-constants.js', '/common/common-constants.js',
'/common/common-feedback.js', '/common/common-feedback.js',
'/common/make-backup.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/sframe-common.js', '/common/sframe-common.js',
'/common/common-realtime.js', '/common/common-realtime.js',
@ -32,6 +33,7 @@ define([
UI, UI,
Constants, Constants,
Feedback, Feedback,
Backup,
nThen, nThen,
SFCommon, SFCommon,
CommonRealtime, CommonRealtime,
@ -90,7 +92,7 @@ define([
var faEmpty = 'fa-trash-o'; var faEmpty = 'fa-trash-o';
var faRestore = 'fa-repeat'; var faRestore = 'fa-repeat';
var faShowParent = 'fa-location-arrow'; var faShowParent = 'fa-location-arrow';
var faDownload = 'cptools-file'; var faDownload = 'fa-download';
var $folderIcon = $('<span>', { var $folderIcon = $('<span>', {
"class": faFolder + " cptools cp-app-drive-icon-folder cp-app-drive-content-icon" "class": faFolder + " cptools cp-app-drive-icon-folder cp-app-drive-content-icon"
}); });
@ -325,22 +327,20 @@ define([
'data-icon': faCollapseAll, 'data-icon': faCollapseAll,
}, Messages.fc_collapseAll)), }, Messages.fc_collapseAll)),
$separator.clone()[0], $separator.clone()[0],
h('li', h('a.cp-app-drive-context-color.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-openparent.dropdown-item', {
'tabindex': '-1',
'data-icon': faColor,
}, Messages.fc_color)),
h('li', h('a.cp-app-drive-context-download.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faDownload, 'data-icon': faShowParent,
}, Messages.download_mt_button)), }, Messages.fm_openParent)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-share.dropdown-item', { h('li', h('a.cp-app-drive-context-share.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': 'fa-shhare-alt', 'data-icon': 'fa-shhare-alt',
}, Messages.shareButton)), }, Messages.shareButton)),
h('li', h('a.cp-app-drive-context-openparent.dropdown-item', { h('li', h('a.cp-app-drive-context-download.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faShowParent, 'data-icon': faDownload,
}, Messages.fm_openParent)), }, Messages.download_mt_button)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-newfolder.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-newfolder.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faFolder, 'data-icon': faFolder,
@ -349,10 +349,6 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faSharedFolder, 'data-icon': faSharedFolder,
}, Messages.fc_newsharedfolder)), }, Messages.fc_newsharedfolder)),
h('li', h('a.cp-app-drive-context-hashtag.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': faTags,
}, Messages.fc_hashtag)),
$separator.clone()[0], $separator.clone()[0],
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
@ -393,6 +389,19 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faRename, 'data-icon': faRename,
}, Messages.fc_rename)), }, Messages.fc_rename)),
h('li', h('a.cp-app-drive-context-color.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': faColor,
}, Messages.fc_color)),
h('li', h('a.cp-app-drive-context-hashtag.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': faTags,
}, Messages.fc_hashtag)),
h('li', h('a.cp-app-drive-context-properties.dropdown-item', {
'tabindex': '-1',
'data-icon': faProperties,
}, Messages.fc_prop)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-delete.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-delete.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faTrash, 'data-icon': faTrash,
@ -409,10 +418,6 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faDelete, 'data-icon': faDelete,
}, Messages.fc_remove_sharedfolder)), }, Messages.fc_remove_sharedfolder)),
h('li', h('a.cp-app-drive-context-properties.dropdown-item', {
'tabindex': '-1',
'data-icon': faProperties,
}, Messages.fc_prop)),
]) ])
]); ]);
$(menu).find("li a.dropdown-item").each(function (i, el) { $(menu).find("li a.dropdown-item").each(function (i, el) {
@ -1008,9 +1013,6 @@ define([
// We can only open parent in virtual categories // We can only open parent in virtual categories
hide.push('openparent'); hide.push('openparent');
} }
if (!$element.is('.cp-border-color-file')) {
hide.push('download');
}
if ($element.is('.cp-app-drive-element-file')) { if ($element.is('.cp-app-drive-element-file')) {
// No folder in files // No folder in files
hide.push('color'); hide.push('color');
@ -3554,14 +3556,39 @@ define([
} }
else if ($(this).hasClass('cp-app-drive-context-download')) { else if ($(this).hasClass('cp-app-drive-context-download')) {
if (paths.length !== 1) { return; } if (paths.length !== 1) { return; }
el = manager.find(paths[0].path); var path = paths[0];
if (!manager.isFile(el)) { return; } el = manager.find(path.path);
console.log("paths", paths);
console.log("el", el);
// folder
if (manager.isFolder(el)) {
// folder
if (!manager.isSharedFolder(el)) {
console.log("--isFolder--");
}
// shared folder
else {
console.log("--isSharedFolder--");
}
}
// file
else if (manager.isFile(el)) {
// imported file
if (path.element.is(".cp-border-color-file")) {
console.log("--isFile--");
data = manager.getFileData(el); data = manager.getFileData(el);
APP.FM.downloadFile(data, function (err, obj) { APP.FM.downloadFile(data, function (err, obj) {
console.log(err, obj); console.log(err, obj);
console.log('DONE'); console.log('DONE');
}); });
} }
// pad
else {
console.log("--isPad--");
}
}
}
else if ($(this).hasClass('cp-app-drive-context-share')) { else if ($(this).hasClass('cp-app-drive-context-share')) {
if (paths.length !== 1) { return; } if (paths.length !== 1) { return; }
el = manager.find(paths[0].path); el = manager.find(paths[0].path);

Loading…
Cancel
Save