Add a button to upload a file in the drive

pull/1/head
yflory 8 years ago
parent 7e0a2abc2c
commit a98353af6c

@ -107,6 +107,8 @@ define(function () {
out.newButton = 'Nouveau'; out.newButton = 'Nouveau';
out.newButtonTitle = 'Créer un nouveau pad'; out.newButtonTitle = 'Créer un nouveau pad';
out.uploadButton = 'Upload';
out.uploadButtonTitle = 'Uploader un nouveau fichier dans le dossier actuel';
out.saveTemplateButton = "Sauver en tant que modèle"; out.saveTemplateButton = "Sauver en tant que modèle";
out.saveTemplatePrompt = "Choisir un titre pour ce modèle"; out.saveTemplatePrompt = "Choisir un titre pour ce modèle";

@ -109,6 +109,8 @@ define(function () {
out.newButton = 'New'; out.newButton = 'New';
out.newButtonTitle = 'Create a new pad'; out.newButtonTitle = 'Create a new pad';
out.uploadButton = 'Upload';
out.uploadButtonTitle = 'Upload a new file to the current folder';
out.saveTemplateButton = "Save as template"; out.saveTemplateButton = "Save as template";
out.saveTemplatePrompt = "Choose a title for the template"; out.saveTemplatePrompt = "Choose a title for the template";

@ -223,7 +223,6 @@ define([
}; };
var handleFile = File.handleFile = function (file, e) { var handleFile = File.handleFile = function (file, e) {
console.log(file);
var reader = new FileReader(); var reader = new FileReader();
reader.onloadend = function () { reader.onloadend = function () {
queue.push({ queue.push({

@ -1441,6 +1441,30 @@ define([
return $block; 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 () { var hideNewButton = function () {
$iframe.find('.dropdown-bar-content').hide(); $iframe.find('.dropdown-bar-content').hide();
}; };
@ -1877,6 +1901,7 @@ define([
// NewButton can be undefined if we're in read only mode // NewButton can be undefined if we're in read only mode
$toolbar.find('.leftside').append(createNewButton(isInRoot)); $toolbar.find('.leftside').append(createNewButton(isInRoot));
$toolbar.find('.leftside').append(createUploadButton());
var $folderHeader = getFolderListHeader(); var $folderHeader = getFolderListHeader();
@ -2700,7 +2725,7 @@ define([
var userList = APP.userList = info.userList; var userList = APP.userList = info.userList;
var config = { var config = {
displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit'], displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad'],
userList: { userList: {
list: userList, list: userList,
userNetfluxId: info.myID userNetfluxId: info.myID

Loading…
Cancel
Save