From a98353af6c299c352c5112f270e6e52909b0ff6e Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 14 Jun 2017 15:55:03 +0200 Subject: [PATCH] Add a button to upload a file in the drive --- customize.dist/translations/messages.fr.js | 2 ++ customize.dist/translations/messages.js | 2 ++ www/common/common-file.js | 1 - www/drive/main.js | 27 +++++++++++++++++++++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 41423fe57..4c5ba9fc9 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -107,6 +107,8 @@ define(function () { out.newButton = 'Nouveau'; 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.saveTemplatePrompt = "Choisir un titre pour ce modèle"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index c549a6009..ceade6204 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -109,6 +109,8 @@ define(function () { out.newButton = 'New'; 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.saveTemplatePrompt = "Choose a title for the template"; diff --git a/www/common/common-file.js b/www/common/common-file.js index bb345565d..43d7cff2a 100644 --- a/www/common/common-file.js +++ b/www/common/common-file.js @@ -223,7 +223,6 @@ define([ }; var handleFile = File.handleFile = function (file, e) { - console.log(file); var reader = new FileReader(); reader.onloadend = function () { queue.push({ diff --git a/www/drive/main.js b/www/drive/main.js index b93086262..0d1f6c0e3 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -1441,6 +1441,30 @@ define([ return $block; }; + var createUploadButton = function () { + var inTrash = filesOp.isPathIn(currentPath, [TRASH]); + var $icon = $('', { + 'class': 'fa fa-upload' + }); + var $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 = $('