Add an info box in the file manager

pull/1/head
yflory 8 years ago
parent c359c27997
commit e9418af88b

@ -190,6 +190,10 @@ define(function () {
out.fm_unknownFolderError = "Le dossier sélectionné ou le dernier dossier visité n'existe plus. Ouverture du dossier parent...";
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/sous-dossiers que vous le souhaitez pour trier vos fichiers.";
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_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
// File - Context menu
out.fc_newfolder = "Nouveau dossier";
out.fc_rename = "Renommer";

@ -189,6 +189,10 @@ define(function () {
out.fm_unknownFolderError = "The selected or last visited directory no longer exist. Opening the parent folder...";
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 folders/subfolders 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_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
// File - Context menu
out.fc_newfolder = "New folder";
out.fc_rename = "Rename";

@ -186,6 +186,14 @@ li {
padding-left: 10px;
}
#content .info-box {
margin: 0px auto;
padding: 5px;
background: #ddddff;
border: 1px solid #bbb;
border-radius: 5px;
}
.topButtonContainer {
border: 1px solid #ccc;
float: right;

@ -58,9 +58,9 @@ define([
var getLastOpenedFolder = function () {
var path;
try {
path = localStorage[LOCALSTORAGE_LAST] ? JSON.parse(localStorage[LOCALSTORAGE_LAST]) : [ROOT];
path = localStorage[LOCALSTORAGE_LAST] ? JSON.parse(localStorage[LOCALSTORAGE_LAST]) : [UNSORTED];
} catch (e) {
path = [ROOT];
path = [UNSORTED];
}
return path;
};
@ -147,7 +147,9 @@ define([
// TOOLBAR
var getLastName = function (cb) {
cb(null, files['cryptpad.username'] || '');
Cryptpad.getAttribute('username', function (err, userName) {
cb(err, userName || '');
});
};
var setName = APP.setName = function (newName) {
@ -157,11 +159,16 @@ define([
myUserNameTemp = myUserNameTemp.substr(0, 32);
}
var myUserName = myUserNameTemp;
files['cryptpad.username'] = myUserName;
APP.userName.lastName = myUserName;
var $button = APP.$userNameButton;
var $span = $('<div>').append($button.find('span').clone()).html();
$button.html($span + myUserName);
Cryptpad.setAttribute('username', myUserName, function (err, data) {
if (err) {
logError("Couldn't set username", err);
return;
}
APP.userName.lastName = myUserName;
var $button = APP.$userNameButton;
var $span = $('<div>').append($button.find('span').clone()).html();
$button.html($span + myUserName);
});
};
var $userBlock = APP.$bar.find('.' + Toolbar.constants.username);
@ -682,6 +689,33 @@ define([
return $title;
};
var createInfoBox = function (path) {
var $box = $('<div>', {'class': 'info-box'});
var msg;
switch (path[0]) {
case 'root':
msg = Messages.fm_info_root;
break;
case 'unsorted':
msg = Messages.fm_info_unsorted;
break;
case 'trash':
msg = Messages.fm_info_trash;
break;
case Cryptpad.storageKey:
msg = Messages.fm_info_allFiles;
break;
default:
msg = undefined;
}
if (!msg} {
$box.hide();
} else {
$box.text(msg);
}
return $box;
};
// Create the button allowing the user to switch from list to icons modes
var createViewModeButton = function () {
var $block = $('<div>', {
@ -1012,6 +1046,7 @@ define([
setLastOpenedFolder(path);
var $title = createTitle(path);
var $info = createInfoBox(path);
var $dirContent = $('<div>', {id: FOLDER_CONTENT_ID});
$dirContent.data('path', path);
@ -1059,7 +1094,7 @@ define([
$element.appendTo($list);
});
}
$content.append($title).append($dirContent);
$content.append($title).append($info).append($dirContent);
appStatus.ready(true);
};

Loading…
Cancel
Save