Merge branch 'staging' into notifications

pull/1/head
yflory 5 years ago
commit baa0e7080a

@ -26,6 +26,8 @@
@colortheme_form-warning: #f49842; @colortheme_form-warning: #f49842;
@colortheme_form-warning-hov: darken(@colortheme_form-warning, 5%); @colortheme_form-warning-hov: darken(@colortheme_form-warning, 5%);
@colortheme_context-menu-icon-color: #7b7b7b;
@colortheme_modal-bg: @colortheme_form-bg-alt; // TODO Modals bg @colortheme_modal-bg: @colortheme_form-bg-alt; // TODO Modals bg
@colortheme_modal-fg: @colortheme_form-color-alt; @colortheme_modal-fg: @colortheme_form-color-alt;
@colortheme_modal-link: @colortheme_link-color; @colortheme_modal-link: @colortheme_link-color;

@ -13,7 +13,17 @@
font-size: @colortheme_app-font-size; font-size: @colortheme_app-font-size;
a { a {
cursor: pointer; cursor: pointer;
.fa, .cptools {
margin-right: 1rem;
color: @colortheme_context-menu-icon-color;
}
} }
} }
.cp-app-drive-context-noAction {
font-style: italic;
color: #aaa;
cursor: default;
display: none;
}
} }
} }

@ -1075,5 +1075,33 @@
"share_description": "Wähle aus, was du teilen möchtest. Dir wird dann ein entsprechender Link anzeigt. Du kannst es auch direkt an deine Freunde in CryptPad senden.", "share_description": "Wähle aus, was du teilen möchtest. Dir wird dann ein entsprechender Link anzeigt. Du kannst es auch direkt an deine Freunde in CryptPad senden.",
"fc_expandAll": "Alle ausklappen", "fc_expandAll": "Alle ausklappen",
"fc_collapseAll": "Alle einklappen", "fc_collapseAll": "Alle einklappen",
"fc_color": "Farbe ändern" "fc_color": "Farbe ändern",
"supportPage": "",
"admin_cat_support": "",
"admin_supportInitHelp": "",
"admin_supportInitPrivate": "",
"admin_supportAddKey": "",
"admin_supportAddError": "",
"admin_supportInitTitle": "",
"admin_supportInitHint": "",
"admin_supportListTitle": "",
"admin_supportListHint": "",
"support_disabledTitle": "",
"support_disabledHint": "",
"support_cat_new": "",
"support_formTitle": "",
"support_formHint": "",
"support_formButton": "",
"support_formTitleError": "",
"support_formContentError": "",
"support_formMessage": "",
"support_cat_tickets": "",
"support_listTitle": "",
"support_listHint": "",
"support_answer": "",
"support_close": "",
"support_remove": "",
"support_showData": "",
"support_from": "",
"support_closed": ""
} }

@ -1056,7 +1056,7 @@
"friendRequest_accepted": "<b>{0}</b> a accepté votre demande d'ami", "friendRequest_accepted": "<b>{0}</b> a accepté votre demande d'ami",
"friendRequest_received": "<b>{0}</b> souhaite être votre ami", "friendRequest_received": "<b>{0}</b> souhaite être votre ami",
"friendRequest_notification": "<b>{0}</b> vous a envoyé une demande d'ami", "friendRequest_notification": "<b>{0}</b> vous a envoyé une demande d'ami",
"notifications_empty": "Vous n'avez pas de nouvelle notification", "notifications_empty": "Pas de nouvelle notification",
"notifications_title": "Vous avez des notifications non lues", "notifications_title": "Vous avez des notifications non lues",
"profile_addDescription": "Ajouter une description", "profile_addDescription": "Ajouter une description",
"profile_editDescription": "Modifier votre description", "profile_editDescription": "Modifier votre description",
@ -1075,5 +1075,35 @@
"notifications_dismiss": "Cacher", "notifications_dismiss": "Cacher",
"fm_info_sharedFolderHistory": "Vous regardez l'historique de votre dossier partagé <b>{0}</b><br/>Votre CryptDrive restera en lecture seule pendant la navigation.", "fm_info_sharedFolderHistory": "Vous regardez l'historique de votre dossier partagé <b>{0}</b><br/>Votre CryptDrive restera en lecture seule pendant la navigation.",
"share_description": "Choisissez ce que vous souhaitez partager puis obtenez le lien ou envoyez-le directement à vos amis CryptPad.", "share_description": "Choisissez ce que vous souhaitez partager puis obtenez le lien ou envoyez-le directement à vos amis CryptPad.",
"fc_color": "Changer la couleur" "fc_color": "Changer la couleur",
"supportPage": "Support",
"admin_cat_support": "Support",
"admin_supportAddKey": "Ajouter la clé",
"admin_supportAddError": "Clé privée non valide",
"admin_supportInitTitle": "Initialisation du support",
"admin_supportListTitle": "Messagerie du support",
"support_disabledTitle": "Le support n'est pas activé",
"support_disabledHint": "Cette instance de CryptPad n'est pas encore configurée pour utiliser le formulaire de support.",
"support_cat_new": "Nouveau ticket",
"support_formTitle": "Titre du ticket",
"support_formButton": "Envoyer",
"support_formTitleError": "Erreur : le titre est vide",
"support_formContentError": "Erreur : le contenu est vide",
"support_formMessage": "Taper votre message...",
"support_cat_tickets": "Tickets existants",
"support_listTitle": "Tickets de support",
"support_answer": "Répondre",
"support_close": "Fermer le ticket",
"support_remove": "Supprimer le ticket",
"support_showData": "Afficher/cacher les données de l'utilisateur",
"support_from": "<b>De :</b> {0}",
"support_closed": "Ce ticket a été fermé",
"fc_noAction": "Pas d'action disponible",
"notificationsPage": "Notifications",
"openNotificationsApp": "Ouvrir le panneau de notifications",
"notifications_cat_all": "Toutes",
"notifications_cat_friends": "Demandes d'ami",
"notifications_cat_pads": "Partagé avec moi",
"notifications_cat_archived": "Historique",
"notifications_dismissAll": "Tout cacher"
} }

@ -1057,7 +1057,7 @@
"friendRequest_accepted": "<b>{0}</b> accepted your friend request", "friendRequest_accepted": "<b>{0}</b> accepted your friend request",
"friendRequest_received": "<b>{0}</b> would like to be your friend", "friendRequest_received": "<b>{0}</b> would like to be your friend",
"friendRequest_notification": "<b>{0}</b> sent you a friend request", "friendRequest_notification": "<b>{0}</b> sent you a friend request",
"notifications_empty": "You have no new notifications", "notifications_empty": "No notifications available",
"notifications_title": "You have unread notifications", "notifications_title": "You have unread notifications",
"profile_addDescription": "Add a description", "profile_addDescription": "Add a description",
"profile_editDescription": "Edit your description", "profile_editDescription": "Edit your description",
@ -1103,5 +1103,13 @@
"support_remove": "Remove the ticket", "support_remove": "Remove the ticket",
"support_showData": "Show/hide user data", "support_showData": "Show/hide user data",
"support_from": "<b>From:</b> {0}", "support_from": "<b>From:</b> {0}",
"support_closed": "This ticket has been closed" "support_closed": "This ticket has been closed",
"fc_noAction": "No action available",
"notificationsPage": "Notifications",
"openNotificationsApp": "Open notifications panel",
"notifications_cat_all": "All",
"notifications_cat_friends": "Friend requests",
"notifications_cat_pads": "Shared with me",
"notifications_cat_archived": "History",
"notifications_dismissAll": "Dismiss all"
} }

@ -514,6 +514,31 @@ define([
data: exp.getFileData(l) data: exp.getFileData(l)
}); });
}); });
// find folders
var resFolders = [];
var findFoldersRec = function (folder, path) {
for (var key in folder) {
if (isFolder(folder[key]) && !isSharedFolder(folder[key])) {
if (key.toLowerCase().indexOf(lValue) !== -1) {
resFolders.push({
id: null,
paths: [path.concat(key)],
data: {
title: key
}
});
}
findFoldersRec(folder[key], path.concat(key));
}
}
};
findFoldersRec(files[ROOT], [ROOT]);
resFolders = resFolders.sort(function (a, b) {
return a.data.title.toLowerCase() > b.data.title.toLowerCase();
});
ret = resFolders.concat(ret);
return ret; return ret;
}; };
exp.getRecentPads = function () { exp.getRecentPads = function () {

@ -513,12 +513,18 @@
} }
.cp-app-drive-search-path { .cp-app-drive-search-path {
font-style: italic; font-style: italic;
display: flex; .cp-app-drive-path-inner {
flex-flow: row-reverse; display: flex;
justify-content: right; flex-flow: row-reverse wrap-reverse;
.cp-app-drive-path-element { justify-content: flex-end;
display: inline-block; .cp-app-drive-path-element {
margin-right: 5px; flex-shrink: 0;
display: inline-block;
margin-right: 5px;
white-space: normal;
word-wrap: break-word;
max-width: 100%;
}
} }
} }
.cp-app-drive-search-title { .cp-app-drive-search-title {

@ -124,6 +124,7 @@ define([
var $tagsIcon = $('<span>', {"class": "fa " + faTags}); var $tagsIcon = $('<span>', {"class": "fa " + faTags});
var $passwordIcon = $('<span>', {"class": "fa fa-lock"}); var $passwordIcon = $('<span>', {"class": "fa fa-lock"});
var $expirableIcon = $('<span>', {"class": "fa fa-clock-o"}); var $expirableIcon = $('<span>', {"class": "fa fa-clock-o"});
var $separator = $('<div>', {"class": "dropdown-divider"});
var LS_LAST = "app-drive-lastOpened"; var LS_LAST = "app-drive-lastOpened";
var LS_OPENED = "app-drive-openedFolders"; var LS_OPENED = "app-drive-openedFolders";
@ -303,6 +304,7 @@ define([
'aria-labelledby': 'dropdownMenu', 'aria-labelledby': 'dropdownMenu',
'style': 'display:block;position:static;margin-bottom:5px;' 'style': 'display:block;position:static;margin-bottom:5px;'
}, [ }, [
h('span.cp-app-drive-context-noAction.dropdown-item.disabled', Messages.fc_noAction || "No action possible"),
h('li', h('a.cp-app-drive-context-open.dropdown-item', { h('li', h('a.cp-app-drive-context-open.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faFolderOpen, 'data-icon': faFolderOpen,
@ -311,6 +313,7 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faReadOnly, 'data-icon': faReadOnly,
}, Messages.fc_open_ro)), }, Messages.fc_open_ro)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-expandall.dropdown-item', { h('li', h('a.cp-app-drive-context-expandall.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': "expandAll", 'data-icon': "expandAll",
@ -319,6 +322,7 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': "collapseAll", 'data-icon': "collapseAll",
}, Messages.fc_collapseAll)), }, Messages.fc_collapseAll)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-color.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-color.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faColor, 'data-icon': faColor,
@ -347,6 +351,7 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faTags, 'data-icon': faTags,
}, Messages.fc_hashtag)), }, Messages.fc_hashtag)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.pad, 'data-icon': AppConfig.applicationsIcon.pad,
@ -372,6 +377,7 @@ define([
'data-icon': AppConfig.applicationsIcon.whiteboard, 'data-icon': AppConfig.applicationsIcon.whiteboard,
'data-type': 'whiteboard' 'data-type': 'whiteboard'
}, Messages.button_newwhiteboard)), }, Messages.button_newwhiteboard)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-empty.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-empty.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faEmpty, 'data-icon': faEmpty,
@ -380,6 +386,7 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faRestore, 'data-icon': faRestore,
}, Messages.fc_restore)), }, Messages.fc_restore)),
$separator.clone()[0],
h('li', h('a.cp-app-drive-context-rename.dropdown-item.cp-app-drive-context-editable', { h('li', h('a.cp-app-drive-context-rename.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faRename, 'data-icon': faRename,
@ -406,6 +413,16 @@ define([
}, Messages.fc_prop)), }, Messages.fc_prop)),
]) ])
]); ]);
$(menu).find("li a.dropdown-item").each(function (i, el) {
var $icon = $("<span>");
if ($(el).attr('data-icon')) {
var font = $(el).attr('data-icon').indexOf('cptools') === 0 ? 'cptools' : 'fa';
$icon.addClass(font).addClass($(el).attr('data-icon'));
} else {
$icon.text($(el).text());
}
$(el).prepend($icon);
});
return $(menu); return $(menu);
}; };
@ -1053,8 +1070,7 @@ define([
show = ['newfolder', 'newsharedfolder', 'newdoc']; show = ['newfolder', 'newsharedfolder', 'newdoc'];
break; break;
case 'tree': case 'tree':
show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', 'properties', 'hashtag'];
'newfolder', 'properties', 'hashtag'];
break; break;
case 'default': case 'default':
show = ['open', 'openro', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'hashtag']; show = ['open', 'openro', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'hashtag'];
@ -1238,6 +1254,20 @@ define([
var displayMenu = function (e) { var displayMenu = function (e) {
var $menu = $contextMenu; var $menu = $contextMenu;
var showSep = false;
var $lastVisibleSep = null;
$menu.find(".dropdown-menu").children().each(function (i, el) {
var $el = $(el);
if ($el.is(".dropdown-divider")) {
$el.css("display", showSep ? "list-item" : "none");
if (showSep) { $lastVisibleSep = $el; }
showSep = false;
}
else if ($el.is("li") && $el.css("display") !== "none") {
showSep = true;
}
});
if (!showSep && $lastVisibleSep) { $lastVisibleSep.css("display", "none"); } // remove last divider if no options after
$menu.css({ display: "block" }); $menu.css({ display: "block" });
if (APP.mobile()) { return; } if (APP.mobile()) { return; }
var h = $menu.outerHeight(); var h = $menu.outerHeight();
@ -1313,11 +1343,7 @@ define([
displayMenu(e); displayMenu(e);
if ($contextMenu.find('li:visible').length === 0) { $(".cp-app-drive-context-noAction").toggle($contextMenu.find('li:visible').length === 0);
debug("No visible element in the context menu. Abort.");
$contextMenu.hide();
return true;
}
$contextMenu.data('paths', paths); $contextMenu.data('paths', paths);
return false; return false;
@ -1345,6 +1371,7 @@ define([
}); });
cb(); cb();
}; };
if (paths.some(function (p) { return manager.comparePath(newPath, p); })) { return void cb(); }
manager.move(paths, newPath, newCb, copy); manager.move(paths, newPath, newCb, copy);
}; };
// Delete paths from the drive and/or shared folders (without moving them to the trash) // Delete paths from the drive and/or shared folders (without moving them to the trash)
@ -2601,32 +2628,17 @@ define([
var displaySearch = function ($list, value) { var displaySearch = function ($list, value) {
var filesList = manager.search(value); var filesList = manager.search(value);
filesList.forEach(function (r) { filesList.forEach(function (r) {
// if r.id === null, then it's a folder, not a file
r.paths.forEach(function (path) { r.paths.forEach(function (path) {
if (!r.inSharedFolder && if (!r.inSharedFolder &&
APP.hideDuplicateOwned && manager.isDuplicateOwned(path)) { return; } APP.hideDuplicateOwned && manager.isDuplicateOwned(path)) { return; }
var href = r.data.href; var href = r.data.href;
var parsed = Hash.parsePadUrl(href); var parsed = Hash.parsePadUrl(href);
var $table = $('<table>'); var $table = $('<table>');
var $icon = $('<td>', {'rowspan': '3', 'class': 'cp-app-drive-search-icon'}) var $icon = $('<td>', {'rowspan': '3', 'class': 'cp-app-drive-search-icon'});
.append(getFileIcon(r.id));
var $title = $('<td>', { var $title = $('<td>', {
'class': 'cp-app-drive-search-col1 cp-app-drive-search-title' 'class': 'cp-app-drive-search-col1 cp-app-drive-search-title'
}).text(r.data.title) }).text(r.data.title);
.click(function () {
openFile(null, r.data.href);
});
var $typeName = $('<td>', {'class': 'cp-app-drive-search-label2'})
.text(Messages.fm_type);
var $type = $('<td>', {'class': 'cp-app-drive-search-col2'})
.text(Messages.type[parsed.type] || parsed.type);
var $atimeName = $('<td>', {'class': 'cp-app-drive-search-label2'})
.text(Messages.fm_lastAccess);
var $atime = $('<td>', {'class': 'cp-app-drive-search-col2'})
.text(new Date(r.data.atime).toLocaleString());
var $ctimeName = $('<td>', {'class': 'cp-app-drive-search-label2'})
.text(Messages.fm_creation);
var $ctime = $('<td>', {'class': 'cp-app-drive-search-col2'})
.text(new Date(r.data.ctime).toLocaleString());
if (manager.isPathIn(path, ['hrefArray'])) { if (manager.isPathIn(path, ['hrefArray'])) {
path.pop(); path.pop();
path.push(r.data.title); path.push(r.data.title);
@ -2635,25 +2647,48 @@ define([
'class': 'cp-app-drive-search-col1 cp-app-drive-search-path' 'class': 'cp-app-drive-search-col1 cp-app-drive-search-path'
}); });
createTitle($path, path, true); createTitle($path, path, true);
var parentPath = path.slice(); var $typeName = $('<td>', {'class': 'cp-app-drive-search-label2'}).text(Messages.fm_type);
var $a; var $type = $('<td>', {'class': 'cp-app-drive-search-col2'});
if (parentPath) { var $atimeName = $('<td>', {'class': 'cp-app-drive-search-label2'});
$a = $('<a>').text(Messages.fm_openParent).click(function (e) { var $atime = $('<td>', {'class': 'cp-app-drive-search-col2'});
e.preventDefault(); var $ctimeName = $('<td>', {'class': 'cp-app-drive-search-label2'});
if (manager.isInTrashRoot(parentPath)) { parentPath = [TRASH]; } var $ctime = $('<td>', {'class': 'cp-app-drive-search-col2'});
else { parentPath.pop(); } var $openDir = $('<td>', {'class': 'cp-app-drive-search-opendir'});
APP.selectedFiles = [r.id]; if (r.id) {
APP.displayDirectory(parentPath); $icon.append(getFileIcon(r.id));
$type.text(Messages.type[parsed.type] || parsed.type);
$title.click(function () {
openFile(null, r.data.href);
}); });
$atimeName.text(Messages.fm_lastAccess);
$atime.text(new Date(r.data.atime).toLocaleString());
$ctimeName.text(Messages.fm_creation);
$ctime.text(new Date(r.data.ctime).toLocaleString());
var parentPath = path.slice();
if (parentPath) {
$('<a>').text(Messages.fm_openParent).click(function (e) {
e.preventDefault();
if (manager.isInTrashRoot(parentPath)) { parentPath = [TRASH]; }
else { parentPath.pop(); }
APP.selectedFiles = [r.id];
APP.displayDirectory(parentPath);
}).appendTo($openDir);
}
$('<a>').text(Messages.fc_prop).click(function () {
APP.getProperties(r.id, function (e, $prop) {
if (e) { return void logError(e); }
UI.alert($prop[0], undefined, true);
});
}).appendTo($openDir);
}
else {
$icon.append($folderIcon.clone());
$type.text(Messages.fm_folder);
$('<a>').text(Messages.fc_open).click(function (e) {
e.preventDefault();
APP.displayDirectory(path);
}).appendTo($openDir);
} }
var $openDir = $('<td>', {'class': 'cp-app-drive-search-opendir'}).append($a);
$('<a>').text(Messages.fc_prop).click(function () {
APP.getProperties(r.id, function (e, $prop) {
if (e) { return void logError(e); }
UI.alert($prop[0], undefined, true);
});
}).appendTo($openDir);
// rows 1-3 // rows 1-3
$('<tr>').append($icon).append($title).append($typeName).append($type).appendTo($table); $('<tr>').append($icon).append($title).append($typeName).append($type).appendTo($table);
@ -3199,7 +3234,7 @@ define([
placeholder: Messages.fm_searchPlaceholder placeholder: Messages.fm_searchPlaceholder
}).keyup(function (e) { }).keyup(function (e) {
if (search.to) { window.clearTimeout(search.to); } if (search.to) { window.clearTimeout(search.to); }
if ([38, 39, 40, 41].indexOf(e.which) !== -1) { if ([37, 38, 39, 40].indexOf(e.which) !== -1) {
if (!$input.val()) { if (!$input.val()) {
$input.blur(); $input.blur();
$content.focus(); $content.focus();
@ -3647,6 +3682,14 @@ define([
APP.hideMenu(); APP.hideMenu();
}); });
$content.on("keydown", function (e) {
if (e.which === 113) {
var paths = $contextMenu.data('paths');
if (paths.length !== 1) { return; }
displayRenameInput(paths[0].element, paths[0].path);
}
});
// Chrome considers the double-click means "select all" in the window // Chrome considers the double-click means "select all" in the window
$content.on('mousedown', function (e) { $content.on('mousedown', function (e) {
$content.focus(); $content.focus();

Loading…
Cancel
Save