From 5b08fed7faebf5ba7d2d652710e6b3aa56202c10 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 9 Jan 2017 16:17:04 +0100 Subject: [PATCH] Ability to add files from the drive toolbar Fix CSS issues with the different toolbars Translate the backup URL button alert --- customize.dist/fsStore.js | 2 +- customize.dist/src/less/toolbar.less | 5 +- customize.dist/toolbar.css | 5 +- customize.dist/translations/messages.fr.js | 10 ++- customize.dist/translations/messages.js | 8 ++- www/common/fileObject.js | 9 +-- www/drive/file.css | 56 ++++++++++++++- www/drive/main.js | 79 ++++++++++++++-------- www/pad/inner.html | 1 + www/poll/index.html | 3 + 10 files changed, 133 insertions(+), 45 deletions(-) diff --git a/customize.dist/fsStore.js b/customize.dist/fsStore.js index bea193fa1..1afd96063 100644 --- a/customize.dist/fsStore.js +++ b/customize.dist/fsStore.js @@ -155,11 +155,11 @@ define([ exp.proxy = rt.proxy; rt.proxy.on('create', function (info) { exp.info = info; - var realtime = info.realtime; if (!Cryptpad.getUserHash()) { localStorage.FS_hash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys); } }).on('ready', function () { + if (ready) { return; } if (!rt.proxy[Cryptpad.storageKey] || !Cryptpad.isArray(rt.proxy[Cryptpad.storageKey])) { var oldStore = Cryptpad.getStore(true); oldStore.get(Cryptpad.storageKey, function (err, s) { diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 454eedbf7..bcdf9fd4d 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -28,7 +28,6 @@ font: normal normal normal 12px Arial,Helvetica,Tahoma,Verdana,Sans-Serif; color: #000; - display: inline-block; width: 100%; z-index: 9001; @@ -38,11 +37,9 @@ .cryptpad-lag { box-sizing: content-box; - vertical-align: top; height: 16px; width: 16px; display: inline-block; - margin: 2px 0px; padding: 5px; div { margin: auto; @@ -62,7 +59,7 @@ height: 26px; padding-right: 5px; padding-left: 5px; - margin: 2px; + margin: 3px 2px; } button { diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index cd9545990..1ecc91116 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -31,7 +31,6 @@ user-select: none; font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif; color: #000; - display: inline-block; width: 100%; z-index: 9001; } @@ -40,11 +39,9 @@ } .cryptpad-toolbar .cryptpad-lag { box-sizing: content-box; - vertical-align: top; height: 16px; width: 16px; display: inline-block; - margin: 2px 0px; padding: 5px; } .cryptpad-toolbar .cryptpad-lag div { @@ -65,7 +62,7 @@ height: 26px; padding-right: 5px; padding-left: 5px; - margin: 2px; + margin: 3px 2px; } .cryptpad-toolbar button { background-color: inherit; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 31bf2df6b..cc1d447dc 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -174,8 +174,9 @@ define(function () { out.fm_trashName = "Corbeille"; out.fm_unsortedName = "Fichiers non triés"; out.fm_filesDataName = "Tous les fichiers"; + out.fm_newButton = "Nouveau"; out.fm_newFolder = "Nouveau dossier"; - out.fm_newFolderButton = "NOUVEAU DOSSIER"; + out.fm_folder = "Dossier"; out.fm_folderName = "Nom du dossier"; out.fm_numberOfFolders = "# de dossiers"; out.fm_numberOfFiles = "# de fichiers"; @@ -199,7 +200,12 @@ define(function () { out.fm_info_unsorted = 'Contient tous les documents que vous avez ouvert et qui ne sont pas triés dans "Documents" ou déplacés vers la "Corbeille".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName" out.fm_info_trash = 'Les fichiers supprimés dans la corbeille sont également enlevés de "Tous les fichiers" et il est impossible de les récupérer depuis l\'explorateur de fichiers.'; // Same here for "All files" and "out.fm_filesDataName" out.fm_info_allFiles = 'Contient tous les fichiers de "Documents", "Fichiers non triés" et "Corbeille". Vous ne pouvez pas supprimer ou déplacer des fichiers d\'ici.'; // Same here - // File - Context menu + out.fm_alert_backupUrl = "URL de secours pour ce contenu.
" + + "Il est fortement recommandé de garder cette URL pour vous-même.
" + + "Elle vous servira en cas de perte des données de votre navigateur afin de retrouver vos fichiers.
" + + "Quiconque se trouve en possession de celle-ci peut modifier ou supprimer tous les fichiers de ce gestionnaire.
" + + ''; + // File - Context menu out.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; out.fc_open = "Ouvrir"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 146c5f655..67ee52f5b 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -176,8 +176,9 @@ define(function () { out.fm_unsortedName = "Unsorted files"; out.fm_filesDataName = "All files"; out.fm_templateName = "Templates"; + out.fm_newButton = "New"; out.fm_newFolder = "New folder"; - out.fm_newFolderButton = "NEW FOLDER"; + out.fm_folder = "Folder"; out.fm_folderName = "Folder name"; out.fm_numberOfFolders = "# of folders"; out.fm_numberOfFiles = "# of files"; @@ -201,6 +202,11 @@ define(function () { out.fm_info_unsorted = 'Contains all the files you\'ve visited that are not yet sorted in "Documents" or moved to the "Trash".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName" out.fm_info_trash = 'Files deleted from the trash are also removed from "All files" and it is impossible to recover them from the file manager.'; // Same here for "All files" and "out.fm_filesDataName" out.fm_info_allFiles = 'Contains all the files from "Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here + out.fm_alert_backupUrl = "Backup URL for this drive.
" + + "It is highly recommended that you keep ip for yourself only.
" + + "You can use it to retrieve all your files in case your browser memory got erased.
" + + "Anybody with that URL can edit or remove all the files in your file manager.
" + + ''; // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/common/fileObject.js b/www/common/fileObject.js index 2f26f3dab..26fdbee93 100644 --- a/www/common/fileObject.js +++ b/www/common/fileObject.js @@ -627,14 +627,15 @@ define([ var trashFiles = getTrashFiles(); var templateFiles = getTemplateFiles(); var newPath, parentEl; - if (path && isPathInHrefArray(path)) { + if (path) { newPath = decodeURIComponent(path).split(','); + } + if (path && isPathInHrefArray(newPath)) { parentEl = findElement(files, newPath); parentEl.push(href); return; } - if (path && name) { - newPath = decodeURIComponent(path).split(','); + if (path && isPathInRoot(newPath) && name) { parentEl = findElement(files, newPath); if (parentEl) { var newName = getAvailableName(parentEl, name); @@ -642,7 +643,7 @@ define([ return; } } - if (unsortedFiles.indexOf(href) === -1 && rootFiles.indexOf(href) === -1&& templateFiles.indexOf(href) === -1 && trashFiles.indexOf(href) === -1) { + if (unsortedFiles.indexOf(href) === -1 && rootFiles.indexOf(href) === -1 && templateFiles.indexOf(href) === -1 && trashFiles.indexOf(href) === -1) { files[UNSORTED].push(href); } }; diff --git a/www/drive/file.css b/www/drive/file.css index fbf914a13..58d9b31d2 100644 --- a/www/drive/file.css +++ b/www/drive/file.css @@ -342,7 +342,6 @@ li { button.newElement { border-radius: 0px; height: 30px; - margin: 5px 5px; background: #888; color: #eee; font-size: 15px; @@ -354,3 +353,58 @@ button.newElement:hover { box-shadow: 0px 0px 2px #000; } + +/* Style The Dropdown Button */ +.dropbtn { + background-color: #4CAF50; + color: white; + padding: 16px; + font-size: 16px; + border: none; + cursor: pointer; +} + +/* The container
- needed to position the dropdown content */ +.dropdown-bar { + margin: 5px 5px; + position: relative; + display: inline-block; +} + +/* Dropdown Content (Hidden by Default) */ +.dropdown-bar-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); +} + +/* Links inside the dropdown */ +.dropdown-bar-content a { + color: black; + padding: 5px 16px; + text-decoration: none; + display: block; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.dropdown-bar-content hr { + margin: 5px 0px; +} + +/* Change color of dropdown links on hover */ +.dropdown-bar-content a:hover {background-color: #f1f1f1} + +/* Show the dropdown menu on hover */ +..dropdown-bar-content:hover { + display: block; +} + +/* Change the background color of the dropdown button when the dropdown content is shown */ +.dropdown-bar:hover .dropbtn { + background-color: #3e8e41; +} diff --git a/www/drive/main.js b/www/drive/main.js index 8edddbb5d..f42ceecda 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -567,7 +567,6 @@ define([ }); var newPath = $(ev.target).data('path') || $(ev.target).parent('li').data('path'); - console.log(newPath); if (!newPath) { return; } if (movedPaths && movedPaths.length) { moveElements(movedPaths, newPath, null, refresh); @@ -839,9 +838,9 @@ define([ }; var createNewFolderButton = function () { - var $listButton = $('