Add a button to upload a file in the drive

This commit is contained in:
yflory
2017-06-14 15:55:03 +02:00
parent 7e0a2abc2c
commit a98353af6c
4 changed files with 30 additions and 2 deletions

View File

@@ -1441,6 +1441,30 @@ define([
return $block;
};
var createUploadButton = function () {
var inTrash = filesOp.isPathIn(currentPath, [TRASH]);
var $icon = $('<span>', {
'class': 'fa fa-upload'
});
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: $content[0]
};
APP.FM.handleFile(file, ev);
});
var $button = $('<button>', {
'class': 'btn btn-primary new',
title: Messages.uploadButtonTitle
}).append($icon).append(' '+Messages.uploadButton).click(function () {
$input.click();
});
return $button;
};
var hideNewButton = function () {
$iframe.find('.dropdown-bar-content').hide();
};
@@ -1877,6 +1901,7 @@ define([
// NewButton can be undefined if we're in read only mode
$toolbar.find('.leftside').append(createNewButton(isInRoot));
$toolbar.find('.leftside').append(createUploadButton());
var $folderHeader = getFolderListHeader();
@@ -2700,7 +2725,7 @@ define([
var userList = APP.userList = info.userList;
var config = {
displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit'],
displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad'],
userList: {
list: userList,
userNetfluxId: info.myID