From d5561910d452023061e193cdc7ed6674ffdd6e01 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 6 Jan 2017 18:26:41 +0100 Subject: [PATCH] Move the file manager into /drive and add a toolbar --- customize.dist/fsStore.js | 2 +- customize.dist/translations/messages.fr.js | 15 ++-- customize.dist/translations/messages.js | 9 ++- www/{file => common}/fileObject.js | 8 ++ www/{file => drive}/file.css | 29 +++++++ www/{file => drive}/index.html | 2 +- www/{file => drive}/inner.html | 0 www/{file => drive}/main.js | 92 +++++++++++++++------- 8 files changed, 117 insertions(+), 40 deletions(-) rename www/{file => common}/fileObject.js (98%) rename www/{file => drive}/file.css (92%) rename www/{file => drive}/index.html (97%) rename www/{file => drive}/inner.html (100%) rename www/{file => drive}/main.js (96%) diff --git a/customize.dist/fsStore.js b/customize.dist/fsStore.js index db94393a9..bea193fa1 100644 --- a/customize.dist/fsStore.js +++ b/customize.dist/fsStore.js @@ -4,7 +4,7 @@ define([ '/bower_components/chainpad-listmap/chainpad-listmap.js', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/textpatcher/TextPatcher.amd.js', - '/file/fileObject.js' + '/common/fileObject.js' ], function (Config, Messages, Listmap, Crypto, TextPatcher, FO) { /* This module uses localStorage, which is synchronous, but exposes an diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index ac72aefc6..31bf2df6b 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -170,7 +170,7 @@ define(function () { // File manager - out.fm_rootName = "Mes documents"; + out.fm_rootName = "Documents"; out.fm_trashName = "Corbeille"; out.fm_unsortedName = "Fichiers non triés"; out.fm_filesDataName = "Tous les fichiers"; @@ -185,6 +185,7 @@ define(function () { out.fm_creation = "Création"; out.fm_forbidden = "Action interdite"; out.fm_originalPath = "Chemin d'origine"; + out.fm_noname = "Document sans titre"; out.fm_emptyTrashDialog = "Êtes-vous sûr de vouloir vider la corbeille ?"; out.fm_removeSeveralPermanentlyDialog = "Êtes-vous sûr de vouloir supprimer ces {0} éléments de manière permanente ?"; out.fm_removePermanentlyDialog = "Êtes-vous sûr de vouloir supprimer {0} de manière permanente ?"; @@ -195,9 +196,9 @@ define(function () { out.fm_contextMenuError = "Impossible d'ouvrir le menu contextuel pour cet élément. Si le problème persiste, essayez de rechercher la page."; out.fm_selectError = "Impossible de sélectionner l'élément ciblé. Si le problème persiste, essayez de recharger la page."; out.fm_info_root = "Créez ici autant de dossiers que vous le souhaitez pour trier vos fichiers."; - out.fm_info_unsorted = 'Contient tous les documents que vous avez ouvert et qui ne sont pas triés dans "Mes 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_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 "Mes documents", "Fichiers non triés" et "Corbeille". Vous ne pouvez pas supprimer ou déplacer des fichiers d\'ici.'; // Same here + 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.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; @@ -234,10 +235,10 @@ define(function () { out.table_created = 'Créé le'; out.table_last = 'Dernier accès'; - out.button_newpad = 'CRÉER UN PAD WYSIWYG'; - out.button_newcode = 'CRÉER UN PAD DE CODE'; - out.button_newpoll = 'CRÉER UN SONDAGE'; - out.button_newslide = 'CRÉER UNE PRÉSENTATION'; + out.button_newpad = 'NOUVEAU DOCUMENT TEXTE'; + out.button_newcode = 'NOUVELLE PAGE DE CODE'; + out.button_newpoll = 'NOUVEAU SONDAGE'; + out.button_newslide = 'NOUVELLE PRÉSENTATION'; // privacy.html diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 36c48315b..146c5f655 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -9,7 +9,7 @@ define(function () { out.main_slogan = "Unity is Strength - Collaboration is Key"; out.type = {}; - out.type.pad = 'Pad'; + out.type.pad = 'Rich text'; out.type.code = 'Code'; out.type.poll = 'Poll'; out.type.slide = 'Presentation'; @@ -171,7 +171,7 @@ define(function () { // File manager - out.fm_rootName = "My documents"; + out.fm_rootName = "Documents"; out.fm_trashName = "Trash"; out.fm_unsortedName = "Unsorted files"; out.fm_filesDataName = "All files"; @@ -187,6 +187,7 @@ define(function () { out.fm_creation = "Creation"; out.fm_forbidden = "Forbidden action"; out.fm_originalPath = "Original path"; + out.fm_noname = "Untitled Document"; out.fm_emptyTrashDialog = "Are you sure you want to empty the trash?"; out.fm_removeSeveralPermanentlyDialog = "Are you sure you want to remove these {0} elements from the trash permanently?"; out.fm_removePermanentlyDialog = "Are you sure you want to remove {0} permanently?"; @@ -197,9 +198,9 @@ define(function () { out.fm_contextMenuError = "Unable to open the context menu for that element. If the problem persist, try to reload the page."; out.fm_selectError = "Unable to select the targetted element. If the problem persist, try to reload the page."; out.fm_info_root = "Create as many nested folders here as you want to sort your files."; - out.fm_info_unsorted = 'Contains all the files you\'ve visited that are not yet sorted in "My 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_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 "My Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here + out.fm_info_allFiles = 'Contains all the files from "Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/file/fileObject.js b/www/common/fileObject.js similarity index 98% rename from www/file/fileObject.js rename to www/common/fileObject.js index e29adfb20..2f26f3dab 100644 --- a/www/file/fileObject.js +++ b/www/common/fileObject.js @@ -264,6 +264,14 @@ define([ if (idx !== -1) { debug("Removing", f, "from filesData"); files[FILES_DATA].splice(idx, 1); + Object.keys(files).forEach(function (key) { + var hash = f.href.indexOf('#') !== -1 ? f.href.slice(f.href.indexOf('#') + 1) : null; + if (hash && key.indexOf(hash) === 0) { + debug("Deleting pad attribute in the realtime object"); + files[key] = undefined; + delete files[key]; + } + }); } }); }; diff --git a/www/file/file.css b/www/drive/file.css similarity index 92% rename from www/file/file.css rename to www/drive/file.css index 1d2f7e1ec..fbf914a13 100644 --- a/www/file/file.css +++ b/www/drive/file.css @@ -184,6 +184,7 @@ li { #content h1 { padding-left: 10px; + margin-top: 10px; } #content .info-box { @@ -325,3 +326,31 @@ li { display: inline; } } + +/* Toolbar */ + +#driveToolbar { + background: #ccc; + height: 40px; +} + +.newPadContainer { + display: inline-block; + height: 100%; +} + +button.newElement { + border-radius: 0px; + height: 30px; + margin: 5px 5px; + background: #888; + color: #eee; + font-size: 15px; + border: none; + font-weight: bold; +} + +button.newElement:hover { + box-shadow: 0px 0px 2px #000; +} + diff --git a/www/file/index.html b/www/drive/index.html similarity index 97% rename from www/file/index.html rename to www/drive/index.html index dfb1ab14a..dd6f8c75c 100644 --- a/www/file/index.html +++ b/www/drive/index.html @@ -1,7 +1,7 @@ - CryptFiles + CryptDrive ', {'class': 'type listElement', title: type}).text(type); var $adate = $('', {'class': 'atime listElement', title: getDate(data.atime)}).text(getDate(data.atime)); var $cdate = $('', {'class': 'ctime listElement', title: getDate(data.ctime)}).text(getDate(data.ctime)); - if (displayTitle && ownFileManager()) { + if (displayTitle && !isWorkgroup()) { $span.append($title); } $span.append($type); - if (ownFileManager()) { + if (!isWorkgroup()) { $span.append($adate).append($cdate); } }; @@ -833,12 +839,8 @@ define([ }; var createNewFolderButton = function () { - var $block = $('
', { - 'class': 'btn-group topButtonContainer newFolderButtonContainer' - }); - var $listButton = $('