Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 8 years ago
commit c0cb5c4263

@ -278,10 +278,6 @@ define([
}; };
loadingScreen = loadingScreen; // TODO use this loadingScreen = loadingScreen; // TODO use this
Pages['/settings/'] = Pages['/settings/index.html'] = function () {
return h('div#container');
};
Pages['/user/'] = Pages['/user/index.html'] = function () { Pages['/user/'] = Pages['/user/index.html'] = function () {
return h('div#container'); return h('div#container');
}; };
@ -509,5 +505,13 @@ define([
return loadingScreen(); return loadingScreen();
}; };
Pages['/settings/'] = Pages['/settings/index.html'] = function () {
return [
h('div#toolbar'),
h('div#container'),
loadingScreen()
];
};
return Pages; return Pages;
}); });

@ -15,7 +15,6 @@ html.cp, .cp body {
background-color: @page-white; //@base; background-color: @page-white; //@base;
color: @fore; color: @fore;
font-family: Ubuntu,Georgia,Cambria,serif;
height: 100%; height: 100%;
} }
.fa { .fa {
@ -27,6 +26,11 @@ html.cp, .cp body {
// override bootstrap colors // override bootstrap colors
.btn-primary { .btn-primary {
background-color: @cp-blue; background-color: @cp-blue;
&:hover {
color: #fff;
background-color: #025aa5;
border-color: #01549b;
}
} }
body { body {
@ -567,10 +571,12 @@ noscript {
/* Pin limit */ /* Pin limit */
.limit-container { .limit-container {
display: inline-flex;
flex-flow: column-reverse;
width: 100%;
margin-top: 20px;
.cryptpad-limit-bar { .cryptpad-limit-bar {
display: inline-block; display: inline-block;
height: 26px;
width: 200px;
max-width: 40vw; max-width: 40vw;
margin: 3px; margin: 3px;
box-sizing: border-box; box-sizing: border-box;
@ -578,8 +584,10 @@ noscript {
background: white; background: white;
position: relative; position: relative;
text-align: center; text-align: center;
line-height: 24px;
vertical-align: middle; vertical-align: middle;
width: ~"calc(100% - 6px)";
height: 25px;
line-height: 25px;
.usage { .usage {
height: 100%; height: 100%;
display: inline-block; display: inline-block;
@ -602,12 +610,16 @@ noscript {
color: black; color: black;
text-shadow: 1px 0 2px white, 0 1px 2px white, -1px 0 2px white, 0 -1px 2px white; text-shadow: 1px 0 2px white, 0 1px 2px white, -1px 0 2px white, 0 -1px 2px white;
z-index: 2; z-index: 2;
font-size: 16px; font-size: @main-font-size;
font-weight: bold; font-weight: bold;
} }
} }
.upgrade { .upgrade {
margin-left: 10px; padding: 0;
line-height: 25px;
height: 25px;
margin: 0 3px;
border-radius: 0;
} }
} }
@ -619,10 +631,10 @@ noscript {
background-color: rgba(0,0,0,0.5); background-color: rgba(0,0,0,0.5);
color: white; color: white;
opacity: 0.7; opacity: 0.7;
font-family: Ubuntu,Georgia,Cambria,serif;
box-sizing: border-box; box-sizing: border-box;
z-index:10000; z-index:10000;
display: none; display: none;
font-family: -apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
#uploadStatus { #uploadStatus {
width: 80vw; width: 80vw;
border: 1px solid black; border: 1px solid black;

@ -1,3 +1,5 @@
@import "/customize/src/less/variables.less";
.fontface(@family, @src, @style: normal, @weight: 400, @fmt: 'truetype'){ .fontface(@family, @src, @style: normal, @weight: 400, @fmt: 'truetype'){
@font-face { @font-face {
font-family: @family; font-family: @family;
@ -76,8 +78,7 @@
height: @width; height: @width;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-right: 5px; border-radius: @width / 2px;
border-radius: @width / 30px;
overflow: hidden; overflow: hidden;
box-sizing: content-box; box-sizing: content-box;
} }
@ -85,7 +86,7 @@
.unselectable(); .unselectable();
background: white; background: white;
color: black; color: black;
font-size: 40px; font-size: @width/1.2;
} }
.right-col { .right-col {
flex: 1; flex: 1;
@ -118,3 +119,21 @@
} }
} }
} }
.leftsideCategory {
.unselectable();
padding: 5px 20px;
margin: 15px 0;
cursor: pointer;
height: @toolbar-line-height;
line-height: @toolbar-line-height - 10px;
.fa {
width: 25px;
}
&:hover {
background: rgba(0,0,0,0.05);
}
&.active {
background: white;
}
}

@ -24,6 +24,7 @@
.friendsColor { color: @toolbar-friends-bg; } .friendsColor { color: @toolbar-friends-bg; }
.whiteboardColor { color: @toolbar-whiteboard-bg; } .whiteboardColor { color: @toolbar-whiteboard-bg; }
.driveColor { color: @toolbar-drive-bg; } .driveColor { color: @toolbar-drive-bg; }
.settingsColor { color: @toolbar-settings-bg; }
.defaultColor { color: @toolbar-default-bg; } .defaultColor { color: @toolbar-default-bg; }
.toolbar-container { .toolbar-container {
@ -56,7 +57,7 @@
} }
body .userlist-drawer { body .userlist-drawer {
font: normal normal normal 16px Arial,Helvetica,Tahoma,Verdana,Sans-Serif; font: normal normal normal @main-font-size Arial,Helvetica,Tahoma,Verdana,Sans-Serif;
min-width: 175px; min-width: 175px;
width: 175px; width: 175px;
display: block; display: block;
@ -95,7 +96,7 @@ body .userlist-drawer {
} }
& > p { & > p {
font: normal normal normal 16px Arial,Helvetica,Tahoma,Verdana,Sans-Serif; font: normal normal normal @main-font-size Arial,Helvetica,Tahoma,Verdana,Sans-Serif;
margin: 0; margin: 0;
padding: 0; padding: 0;
display: block; display: block;
@ -110,8 +111,9 @@ body .userlist-drawer {
padding: 5px; padding: 5px;
margin: 2px 0; margin: 2px 0;
background: rgba(0,0,0,0.1); background: rgba(0,0,0,0.1);
.avatar(50px); .avatar(30px);
.default, media-tag { .default, media-tag {
margin-right: 5px;
border: 1px solid black; border: 1px solid black;
} }
} }
@ -143,7 +145,7 @@ body {
} }
} }
.cryptpad-spinner, .cryptpad-state { .cryptpad-spinner, .cryptpad-state {
font-size: 16px; font-size: @main-font-size;
color: @color; color: @color;
} }
.cryptpad-limit { .cryptpad-limit {
@ -261,6 +263,11 @@ body {
@color: @toolbar-friends-color; @color: @toolbar-friends-color;
.addToolbarColors(@color, @bgcolor); .addToolbarColors(@color, @bgcolor);
} }
&.app-settings {
@bgcolor: @toolbar-settings-bg;
@color: @toolbar-settings-color;
.addToolbarColors(@color, @bgcolor);
}
} }
@ -465,7 +472,7 @@ body .cryptpad-toolbar {
} }
button, select, .rightside-element { button, select, .rightside-element {
height: 32px; height: @toolbar-line-height;
box-sizing: border-box; box-sizing: border-box;
padding: 3px 10px; padding: 3px 10px;
margin: 0; margin: 0;
@ -575,7 +582,7 @@ body .cryptpad-toolbar {
flex: auto; flex: auto;
width: 100%; width: 100%;
order: 10; order: 10;
height: 32px; height: @toolbar-line-height;
line-height: initial; line-height: initial;
margin: 0; margin: 0;
.hoverable { .hoverable {
@ -586,24 +593,24 @@ body .cryptpad-toolbar {
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 16px; font-size: @main-font-size;
height: 32px; height: @toolbar-line-height;
box-sizing: border-box; box-sizing: border-box;
line-height: 20px; line-height: 20px;
} }
.pencilIcon, .saveIcon { .pencilIcon, .saveIcon {
box-sizing: border-box; box-sizing: border-box;
height: 32px; height: @toolbar-line-height;
line-height: 16px; line-height: @main-font-size;
display: inline-block; display: inline-block;
.fa { .fa {
font-size: 16px; font-size: @main-font-size;
} }
} }
input { input {
height: 32px; height: @toolbar-line-height;
font-size: 16px; font-size: @main-font-size;
flex: 1; flex: 1;
max-width: none; max-width: none;
} }
@ -640,6 +647,9 @@ body .cryptpad-toolbar {
line-height: 25px; line-height: 25px;
white-space: nowrap; white-space: nowrap;
} }
.pageTitle {
padding: 0 5px;
}
.pencilIcon, .saveIcon { .pencilIcon, .saveIcon {
display: flex; display: flex;
align-items: center; align-items: center;
@ -785,7 +795,7 @@ body .cryptpad-toolbar {
vertical-align: top; vertical-align: top;
} }
.cryptpad-upgrade { .cryptpad-upgrade {
height: 32px; height: @toolbar-line-height;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
} }
@ -819,7 +829,10 @@ body .cryptpad-toolbar {
font-size: 32px; font-size: 32px;
} }
&.avatar { &.avatar {
.avatar(64px); .avatar(48px);
media-tag {
margin: 8px;
}
border: 0; border: 0;
} }
} }
@ -835,7 +848,7 @@ body .cryptpad-toolbar {
} }
} }
.cryptpad-toolbar-leftside { .cryptpad-toolbar-leftside {
height: 32px; height: @toolbar-line-height;
&:empty { &:empty {
height: 0; height: 0;
} }
@ -870,7 +883,7 @@ body .cryptpad-toolbar {
} }
} }
.cryptpad-toolbar-rightside { .cryptpad-toolbar-rightside {
min-height: 32px; min-height: @toolbar-line-height;
overflow: hidden; overflow: hidden;
&:empty { &:empty {
min-height: 0; min-height: 0;
@ -890,7 +903,7 @@ body .cryptpad-toolbar {
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2);
position: absolute; position: absolute;
right:0px; right:0px;
margin-top: 32px; margin-top: @toolbar-line-height;
min-width: 50px; min-width: 50px;
background: @dropdown-bg; background: @dropdown-bg;
display: flex; display: flex;
@ -903,7 +916,7 @@ body .cryptpad-toolbar {
&> span { &> span {
box-sizing: border-box; box-sizing: border-box;
min-width: 150px; min-width: 150px;
height: 32px; height: @toolbar-line-height;
border-radius: 0; border-radius: 0;
border: 0; border: 0;
} }

@ -7,6 +7,8 @@
@old-base: #302B28; @old-base: #302B28;
@old-fore: #fafafa; @old-fore: #fafafa;
@main-font-size: 16px;
@cp-green: #46E981; @cp-green: #46E981;
@cp-accent: lighten(@cp-green, 20%); @cp-accent: lighten(@cp-green, 20%);
@ -73,7 +75,7 @@
// Dropdown // Dropdown
@dropdown-font: 16px -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; @dropdown-font: @main-font-size -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
@dropdown-bg: #f9f9f9; @dropdown-bg: #f9f9f9;
@dropdown-color: black; @dropdown-color: black;
@dropdown-bg-hover: #f1f1f1; @dropdown-bg-hover: #f1f1f1;
@ -101,6 +103,8 @@
@toolbar-friends-color: #fff; @toolbar-friends-color: #fff;
@toolbar-default-bg: #ddd; @toolbar-default-bg: #ddd;
@toolbar-default-color: #000; @toolbar-default-color: #000;
@toolbar-settings-bg: #0087ff;
@toolbar-settings-color: #fff;
@topbar-back: #fff; @topbar-back: #fff;
@ -129,3 +133,5 @@
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
@toolbar-line-height: 32px;

@ -12,7 +12,7 @@ $(function () {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
var $body = $('body'); var $body = $('body');
var isMainApp = function () { var isMainApp = function () {
return /^\/(pad|code|slide|poll|whiteboard|file|media|friends|drive)\/$/.test(location.pathname); return /^\/(pad|code|slide|poll|whiteboard|file|media|friends|drive|settings)\/$/.test(location.pathname);
}; };
var rightLink = function (ref, loc, txt) { var rightLink = function (ref, loc, txt) {
@ -160,6 +160,9 @@ $(function () {
} else if (/slide/.test(pathname)) { } else if (/slide/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML); $('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/slide/main.js' ], ready); require([ '/slide/main.js' ], ready);
} else if (/^\/settings\//.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/settings/main.js', ], ready);
} }
}); });
@ -173,9 +176,7 @@ $(function () {
], function () { ], function () {
$body.append($topbar).append($main).append($footer); $body.append($topbar).append($main).append($footer);
if (/^\/settings\//.test(pathname)) { if (/^\/profile\//.test(pathname)) {
require([ '/settings/main.js', ], function () {});
} else if (/^\/profile\//.test(pathname)) {
require([ '/profile/main.js'], function () {}); require([ '/profile/main.js'], function () {});
} else if (/^\/user\//.test(pathname)) { } else if (/^\/user\//.test(pathname)) {
require([ '/user/main.js'], function () {}); require([ '/user/main.js'], function () {});

@ -9,7 +9,7 @@ define(function () {
out.type.code = 'Code'; out.type.code = 'Code';
out.type.poll = 'Sondage'; out.type.poll = 'Sondage';
out.type.slide = 'Présentation'; out.type.slide = 'Présentation';
out.type.drive = 'Drive'; out.type.drive = 'CryptDrive';
out.type.whiteboard = "Tableau Blanc"; out.type.whiteboard = "Tableau Blanc";
out.type.file = "Fichier"; out.type.file = "Fichier";
out.type.media = "Média"; out.type.media = "Média";
@ -294,7 +294,7 @@ define(function () {
out.updated_0_fm_info_trash = "Vider la corbeille permet de libérer de l'espace dans votre CryptDrive"; out.updated_0_fm_info_trash = "Vider la corbeille permet de libérer de l'espace dans votre CryptDrive";
out.fm_info_trash = out.updated_0_fm_info_trash; out.fm_info_trash = out.updated_0_fm_info_trash;
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 depuis cet endroit.'; // 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 depuis cet endroit.'; // Same here
out.fm_info_anonymous = 'Vous n\'êtes pas connectés, ces pads risquent donc d\'être supprimés (<a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">découvrez pourquoi</a>). ' + out.fm_info_anonymous = 'Vous n\'êtes pas connecté, ces pads risquent donc d\'être supprimés (<a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">découvrez pourquoi</a>). ' +
'<a href="/register/">Inscrivez-vous</a> ou <a href="/login/">connectez-vous</a> pour les maintenir en vie.'; '<a href="/register/">Inscrivez-vous</a> ou <a href="/login/">connectez-vous</a> pour les maintenir en vie.';
out.fm_alert_backupUrl = "Lien de secours pour ce CryptDrive.<br>" + out.fm_alert_backupUrl = "Lien de secours pour ce CryptDrive.<br>" +
"Il est <strong>fortement recommandé</strong> de garder ce lien pour vous-même.<br>" + "Il est <strong>fortement recommandé</strong> de garder ce lien pour vous-même.<br>" +
@ -375,27 +375,36 @@ define(function () {
]; ];
// Settings // Settings
out.settings_cat_account = "Compte";
out.settings_cat_drive = "CryptDrive";
out.settings_title = "Préférences"; out.settings_title = "Préférences";
out.settings_save = "Sauver"; out.settings_save = "Sauver";
out.settings_backupCategory = "Sauvegarde";
out.settings_backupTitle = "Créer ou restaurer une sauvegarde de vos données"; out.settings_backupTitle = "Créer ou restaurer une sauvegarde de vos données";
out.settings_backup = "Créer une sauvegarde"; out.settings_backup = "Sauvegarder";
out.settings_restore = "Restaurer une sauvegarde"; out.settings_restore = "Restaurer";
out.settings_resetTitle = "Vider votre drive";
out.settings_resetNewTitle = "Vider CryptDrive";
out.settings_resetButotn = "Supprimer";
out.settings_reset = "Supprimer tous les fichiers et dossiers de votre CryptDrive"; out.settings_reset = "Supprimer tous les fichiers et dossiers de votre CryptDrive";
out.settings_resetPrompt = "Cette action va supprimer tous les pads de votre drive.<br>"+ out.settings_resetPrompt = "Cette action va supprimer tous les pads de votre drive.<br>"+
"Êtes-vous sûr de vouloir continuer ?<br>" + "Êtes-vous sûr de vouloir continuer ?<br>" +
"Tapez “<em>I love CryptPad</em>” pour confirmer."; "Tapez “<em>I love CryptPad</em>” pour confirmer.";
out.settings_resetDone = "Votre drive est désormais vide!"; out.settings_resetDone = "Votre drive est désormais vide!";
out.settings_resetError = "Texte de vérification incorrect. Votre CryptDrive n'a pas été modifié."; out.settings_resetError = "Texte de vérification incorrect. Votre CryptDrive n'a pas été modifié.";
out.settings_resetTips = "Astuces et informations dans CryptDrive";
out.settings_resetTipsAction ="Réinitialiser";
out.settings_resetTips = "Astuces";
out.settings_resetTipsButton = "Réinitialiser les astuces visibles dans CryptDrive"; out.settings_resetTipsButton = "Réinitialiser les astuces visibles dans CryptDrive";
out.settings_resetTipsDone = "Toutes les astuces sont de nouveau visibles."; out.settings_resetTipsDone = "Toutes les astuces sont de nouveau visibles.";
out.settings_importTitle = "Importer les pads récents de ce navigateur dans mon CryptDrive"; out.settings_importTitle = "Importer les pads récents de ce navigateur dans votre CryptDrive";
out.settings_import = "Importer"; out.settings_import = "Importer";
out.settings_importConfirm = "Êtes-vous sûr de vouloir importer les pads récents de ce navigateur dans le CryptDrive de votre compte utilisateur ?"; out.settings_importConfirm = "Êtes-vous sûr de vouloir importer les pads récents de ce navigateur dans le CryptDrive de votre compte utilisateur ?";
out.settings_importDone = "Importation terminée"; out.settings_importDone = "Importation terminée";
out.settings_userFeedbackTitle = "Retour d'expérience";
out.settings_userFeedbackHint1 = "CryptPad peut envoyer des retours d'expérience très limités vers le serveur, de manière à nous permettre d'améliorer l'expérience des utilisateurs. "; out.settings_userFeedbackHint1 = "CryptPad peut envoyer des retours d'expérience très limités vers le serveur, de manière à nous permettre d'améliorer l'expérience des utilisateurs. ";
out.settings_userFeedbackHint2 = "Le contenu de vos pads et les clés de déchiffrement ne seront jamais partagés avec le serveur."; out.settings_userFeedbackHint2 = "Le contenu de vos pads et les clés de déchiffrement ne seront jamais partagés avec le serveur.";
out.settings_userFeedback = "Activer l'envoi de retours d'expérience"; out.settings_userFeedback = "Activer l'envoi de retours d'expérience";
@ -409,10 +418,12 @@ define(function () {
out.settings_pinningError = "Un problème est survenu"; out.settings_pinningError = "Un problème est survenu";
out.settings_usageAmount = "Vos pads épinglés occupent {0} Mo"; out.settings_usageAmount = "Vos pads épinglés occupent {0} Mo";
out.settings_logoutEverywhereButton = "Se déconnecter";
out.settings_logoutEverywhereTitle = "Se déconnecter partout"; out.settings_logoutEverywhereTitle = "Se déconnecter partout";
out.settings_logoutEverywhere = "Se déconnecter de toutes les autres sessions."; out.settings_logoutEverywhere = "Se déconnecter de force de toutes les autres sessions.";
out.settings_logoutEverywhereConfirm = "Êtes-vous sûr ? Vous devrez vous reconnecter sur tous vos autres appareils."; out.settings_logoutEverywhereConfirm = "Êtes-vous sûr ? Vous devrez vous reconnecter sur tous vos autres appareils.";
out.upload_title = "Hébergement de fichiers";
out.upload_serverError = "Erreur interne: impossible d'importer le fichier pour l'instant."; out.upload_serverError = "Erreur interne: impossible d'importer le fichier pour l'instant.";
out.upload_uploadPending = "Vous avez déjà un fichier en cours d'importation. Souhaitez-vous l'annuler et importer ce nouveau fichier ?"; out.upload_uploadPending = "Vous avez déjà un fichier en cours d'importation. Souhaitez-vous l'annuler et importer ce nouveau fichier ?";
out.upload_success = "Votre fichier ({0}) a été importé avec succès et ajouté à votre CryptDrive."; out.upload_success = "Votre fichier ({0}) a été importé avec succès et ajouté à votre CryptDrive.";

@ -9,7 +9,7 @@ define(function () {
out.type.code = 'Code'; out.type.code = 'Code';
out.type.poll = 'Poll'; out.type.poll = 'Poll';
out.type.slide = 'Presentation'; out.type.slide = 'Presentation';
out.type.drive = 'Drive'; out.type.drive = 'CryptDrive';
out.type.whiteboard = 'Whiteboard'; out.type.whiteboard = 'Whiteboard';
out.type.file = 'File'; out.type.file = 'File';
out.type.media = 'Media'; out.type.media = 'Media';
@ -387,27 +387,36 @@ define(function () {
out.register_alreadyRegistered = "This user already exists, do you want to log in?"; out.register_alreadyRegistered = "This user already exists, do you want to log in?";
// Settings // Settings
out.settings_cat_account = "Account";
out.settings_cat_drive = "CryptDrive";
out.settings_title = "Settings"; out.settings_title = "Settings";
out.settings_save = "Save"; out.settings_save = "Save";
out.settings_backupCategory = "Backup";
out.settings_backupTitle = "Backup or restore all your data"; out.settings_backupTitle = "Backup or restore all your data";
out.settings_backup = "Backup"; out.settings_backup = "Backup";
out.settings_restore = "Restore"; out.settings_restore = "Restore";
out.settings_resetTitle = "Clean your drive";
out.settings_resetNewTitle = "Clean CryptDrive";
out.settings_resetButton = "Remove";
out.settings_reset = "Remove all the files and folders from your CryptDrive"; out.settings_reset = "Remove all the files and folders from your CryptDrive";
out.settings_resetPrompt = "This action will remove all the pads from your drive.<br>"+ out.settings_resetPrompt = "This action will remove all the pads from your drive.<br>"+
"Are you sure you want to continue?<br>" + "Are you sure you want to continue?<br>" +
"Type “<em>I love CryptPad</em>” to confirm."; "Type “<em>I love CryptPad</em>” to confirm.";
out.settings_resetDone = "Your drive is now empty!"; out.settings_resetDone = "Your drive is now empty!";
out.settings_resetError = "Incorrect verification text. Your CryptDrive has not been changed."; out.settings_resetError = "Incorrect verification text. Your CryptDrive has not been changed.";
out.settings_resetTips = "Tips in CryptDrive";
out.settings_resetTipsAction = "Reset";
out.settings_resetTips = "Tips";
out.settings_resetTipsButton = "Reset the available tips in CryptDrive"; out.settings_resetTipsButton = "Reset the available tips in CryptDrive";
out.settings_resetTipsDone = "All the tips are now visible again."; out.settings_resetTipsDone = "All the tips are now visible again.";
out.settings_importTitle = "Import this browser's recent pads in my CryptDrive"; out.settings_importTitle = "Import this browser's recent pads in your CryptDrive";
out.settings_import = "Import"; out.settings_import = "Import";
out.settings_importConfirm = "Are you sure you want to import recent pads from this browser to your user account's CryptDrive?"; out.settings_importConfirm = "Are you sure you want to import recent pads from this browser to your user account's CryptDrive?";
out.settings_importDone = "Import completed"; out.settings_importDone = "Import completed";
out.settings_userFeedbackTitle = "Feedback";
out.settings_userFeedbackHint1 = "CryptPad provides some very basic feedback to the server, to let us know how to improve your experience. "; out.settings_userFeedbackHint1 = "CryptPad provides some very basic feedback to the server, to let us know how to improve your experience. ";
out.settings_userFeedbackHint2 = "Your pad's content will never be shared with the server."; out.settings_userFeedbackHint2 = "Your pad's content will never be shared with the server.";
out.settings_userFeedback = "Enable user feedback"; out.settings_userFeedback = "Enable user feedback";
@ -421,10 +430,12 @@ define(function () {
out.settings_pinningError = "Something went wrong"; out.settings_pinningError = "Something went wrong";
out.settings_usageAmount = "Your pinned pads occupy {0}MB"; out.settings_usageAmount = "Your pinned pads occupy {0}MB";
out.settings_logoutEverywhereButton = "Log out";
out.settings_logoutEverywhereTitle = "Log out everywhere"; out.settings_logoutEverywhereTitle = "Log out everywhere";
out.settings_logoutEverywhere = "Log out of all other web sessions"; out.settings_logoutEverywhere = "Force log out of all other web sessions";
out.settings_logoutEverywhereConfirm = "Are you sure? You will need to log in with all your devices."; out.settings_logoutEverywhereConfirm = "Are you sure? You will need to log in with all your devices.";
out.upload_title = "File upload";
out.upload_serverError = "Server Error: unable to upload your file at this time."; out.upload_serverError = "Server Error: unable to upload your file at this time.";
out.upload_uploadPending = "You already have an upload in progress. Cancel it and upload your new file?"; out.upload_uploadPending = "You already have an upload in progress. Cancel it and upload your new file?";
out.upload_success = "Your file ({0}) has been successfully uploaded and added to your drive."; out.upload_success = "Your file ({0}) has been successfully uploaded and added to your drive.";

@ -6,6 +6,7 @@ define([
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/code/code.less', 'less!/code/code.less',
'less!/customize/src/less/toolbar.less', 'less!/customize/src/less/toolbar.less',
'less!/customize/src/less/cryptpad.less',
'css!cm/lib/codemirror.css', 'css!cm/lib/codemirror.css',
'css!cm/addon/dialog/dialog.css', 'css!cm/addon/dialog/dialog.css',
'css!cm/addon/fold/foldgutter.css', 'css!cm/addon/fold/foldgutter.css',

@ -364,6 +364,21 @@ define([
return; return;
} }
UserList.getLastName(toolbar.$userNameButton, isNew); UserList.getLastName(toolbar.$userNameButton, isNew);
var fmConfig = {
dropArea: $iframe.find('.CodeMirror'),
body: $iframe.find('body'),
onUploaded: function (ev, data) {
//var cursor = editor.getCursor();
//var cleanName = data.name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.url+')';
var parsed = Cryptpad.parsePadUrl(data.url);
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
editor.replaceSelection(mt);
}
};
APP.FM = Cryptpad.createFileManager(fmConfig);
}; };
config.onRemote = function () { config.onRemote = function () {

@ -1657,7 +1657,7 @@ define([
content: Messages.user_rename content: Messages.user_rename
}); });
} }
if (account) { if (account && parsed && (!parsed.type || parsed.type !== 'profile')) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'profile'}, attributes: {'class': 'profile'},

@ -143,7 +143,17 @@ define([
DiffMd.apply = function (newHtml, $content) { DiffMd.apply = function (newHtml, $content) {
var id = $content.attr('id'); var id = $content.attr('id');
if (!id) { throw new Error("The element must have a valid id"); } if (!id) { throw new Error("The element must have a valid id"); }
var $div = $('<div>', {id: id}).append(newHtml); var pattern = /(<media-tag src="([^"]*)" data-crypto-key="([^"]*)">)<\/media-tag>/g;
var newHtmlFixed = newHtml.replace(pattern, function (all, tag, src) {
var mt = tag;
if (mediaMap[src]) {
mediaMap[src].forEach(function (n) {
mt += n.outerHTML;
});
}
return mt + '</media-tag>';
});
var $div = $('<div>', {id: id}).append(newHtmlFixed);
var Dom = domFromHTML($('<div>').append($div).html()); var Dom = domFromHTML($('<div>').append($div).html());
var oldDom = domFromHTML($content[0].outerHTML); var oldDom = domFromHTML($content[0].outerHTML);
var patch = makeDiff(oldDom, Dom, id); var patch = makeDiff(oldDom, Dom, id);
@ -154,9 +164,11 @@ define([
var $mts = $content.find('media-tag:not(:has(*))'); var $mts = $content.find('media-tag:not(:has(*))');
$mts.each(function (i, el) { $mts.each(function (i, el) {
MediaTag(el); MediaTag(el);
console.log(el.outerHTML);
var observer = new MutationObserver(function(mutations) { var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if (mutation.type === 'childList') { if (mutation.type === 'childList') {
console.log(el.outerHTML);
var list_values = [].slice.call(el.children); var list_values = [].slice.call(el.children);
mediaMap[el.getAttribute('src')] = list_values; mediaMap[el.getAttribute('src')] = list_values;
} }

@ -600,6 +600,21 @@ define([
return $titleContainer; return $titleContainer;
}; };
var createPageTitle = function (toolbar, config) {
if (config.title || !config.pageTitle) { return; }
var $titleContainer = $('<span>', {
id: 'toolbarTitle',
'class': TITLE_CLS
}).appendTo(toolbar.$top);
var $hoverable = $('<span>', {'class': 'hoverable'}).appendTo($titleContainer);
// Buttons
$('<span>', {
'class': 'title pageTitle'
}).appendTo($hoverable).text(config.pageTitle);
};
var createLinkToMain = function (toolbar) { var createLinkToMain = function (toolbar) {
var $linkContainer = $('<span>', { var $linkContainer = $('<span>', {
'class': "cryptpad-link" 'class': "cryptpad-link"
@ -823,7 +838,6 @@ define([
console.error(err); console.error(err);
return; return;
} }
updateDisplayName(toolbar, config);
Cryptpad.changeDisplayName(newName, true); Cryptpad.changeDisplayName(newName, true);
}); });
}); });
@ -831,6 +845,7 @@ define([
}); });
Cryptpad.onDisplayNameChanged(function () { Cryptpad.onDisplayNameChanged(function () {
Cryptpad.findCancelButton().click(); Cryptpad.findCancelButton().click();
updateDisplayName(toolbar, config);
}); });
updateDisplayName(toolbar, config); updateDisplayName(toolbar, config);
@ -1020,6 +1035,7 @@ define([
tb['share'] = createShare; tb['share'] = createShare;
tb['fileshare'] = createFileShare; tb['fileshare'] = createFileShare;
tb['title'] = createTitle; tb['title'] = createTitle;
tb['pageTitle'] = createPageTitle;
tb['lag'] = createLag; tb['lag'] = createLag;
tb['spinner'] = createSpinner; tb['spinner'] = createSpinner;
tb['state'] = createState; tb['state'] = createState;

@ -37,7 +37,7 @@ html, body {
padding: 0; padding: 0;
margin: 0; margin: 0;
position: relative; position: relative;
font-size: 16px; font-size: @main-font-size;
overflow: auto; overflow: auto;
} }
@ -72,7 +72,7 @@ img.icon {
width: 100%; width: 100%;
max-width: unset; max-width: unset;
border-bottom: 1px solid @toolbar-border-col; border-bottom: 1px solid @toolbar-border-col;
.category2 { .category {
margin-top: 0.5em; margin-top: 0.5em;
} }
} }
@ -93,8 +93,6 @@ div:focus {
} }
.fa { .fa {
/*min-width: 17px;*/
margin-right: 3px;
font-family: FontAwesome; font-family: FontAwesome;
} }
@ -111,17 +109,13 @@ li {
user-select: none; user-select: none;
} }
.folder, .file {
margin-right: 5px;
}
.contextMenu { .contextMenu {
display: none; display: none;
position: absolute; position: absolute;
z-index: 500; z-index: 500;
li { li {
padding: 0; padding: 0;
font-size: 16px; font-size: @main-font-size;
a { a {
cursor: pointer; cursor: pointer;
} }
@ -164,6 +158,7 @@ span {
#tree { #tree {
font-size: @main-font-size;
//border-right: 1px solid #ccc; //border-right: 1px solid #ccc;
box-sizing: border-box; box-sizing: border-box;
background: @tree-bg; background: @tree-bg;
@ -187,9 +182,12 @@ span {
margin-bottom: 3px; margin-bottom: 3px;
margin-left: -2px; margin-left: -2px;
} }
li { .docTree {
padding: 0 0 0 5px; margin-top: 20px;
padding: 0 0 0 20px;
cursor: auto; cursor: auto;
&li, li {
padding: 0;
&.collapsed ul { &.collapsed ul {
display: none; display: none;
} }
@ -197,38 +195,63 @@ span {
width: ~"calc(100% - 30px)"; width: ~"calc(100% - 30px)";
} }
& > span.element-row { & > span.element-row {
min-width: ~"calc(100% + 5px)"; overflow: hidden;
text-overflow: ellipsis;
//min-width: ~"calc(100% + 5px)";
.leftsideCategory();
width: ~"calc(100% + 5px)";
margin: 0;
margin-bottom: -6px;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
margin-left: -5px; margin-left: -5px;
padding-left: 5px; padding-left: 5px;
} }
& > span.element-row:not(.selected):not(.active):hover { & > span.element-row:not(.selected):not(.active):hover {
background-color: @drive-hover; //background-color: @drive-hover;
}
} }
} }
span.element { span.element {
cursor: pointer; cursor: pointer;
} }
.active { /*.active {
&:not(.selected):not(.droppable) { &:not(.selected):not(.droppable) {
background-color: darken(@drive-hover, 15%); background-color: darken(@drive-hover, 15%);
} }
} }*/
.category2 { .category {
margin-top: 2em; margin: 0;
margin-top: 15px;
.root { .root {
&> .fa { &> .fa {
min-width: 30px; min-width: 30px;
cursor: pointer; cursor: pointer;
} }
} }
li {
padding: 0;
.element-row {
display: block;
padding-left: 20px;
.leftsideCategory();
margin: 0;
.fa {
width: 25px;
}
}
}
}
.category:last-child {
margin-bottom: 20px;
} }
#allfilesTree { #allfilesTree {
margin-top: 0; margin-top: 0;
} }
.limit-container {
margin-top: 0;
}
#searchContainer { #searchContainer {
margin-bottom: 20px;
text-align: center; text-align: center;
padding: 0; padding: 0;
position: relative; position: relative;
@ -243,7 +266,7 @@ span {
border: 0; border: 0;
border-right: 1px solid lighten(@toolbar-drive-bg, 16%); border-right: 1px solid lighten(@toolbar-drive-bg, 16%);
//border-right: 0; //border-right: 0;
height: 32px; height: @toolbar-line-height;
padding: 0 5px; padding: 0 5px;
padding-left: 45px; padding-left: 45px;
&:focus { &:focus {
@ -262,9 +285,9 @@ span {
font-size: 14px; font-size: 14px;
position: absolute; position: absolute;
left: -20px; left: -20px;
top: 9px; top: 10px;
width: auto; width: 11px !important;
height: 11px; height: 11px !important;
padding: 0; padding: 0;
margin: 0; margin: 0;
background: white; background: white;
@ -277,7 +300,7 @@ span {
} }
// Expand/collapse lines // Expand/collapse lines
ul { .docTree ul {
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
list-style: none; list-style: none;
padding-left: 10px; padding-left: 10px;
@ -286,13 +309,13 @@ span {
&:before { &:before {
position: absolute; position: absolute;
left: -15px; left: -15px;
top: -0.25em; top: -11px;
content: ''; content: '';
display: block; display: block;
border-left: 1px solid @tree-lines-col; border-left: 1px solid @tree-lines-col;
height: 1em; height: ~"calc(1em + 11px)";
border-bottom: 1px solid @tree-lines-col; border-bottom: 1px solid @tree-lines-col;
width: 17.5px; width: 15px;
} }
&:after { &:after {
position: absolute; position: absolute;
@ -317,27 +340,6 @@ span {
} }
} }
} }
.limit-container {
display: inline-flex;
flex-flow: column-reverse;
width: 100%;
margin-top: 20px;
.upgrade {
padding: 0;
line-height: 25px;
height: 25px;
margin: 0 3px;
border-radius: 0;
}
.cryptpad-limit-bar {
width: ~"calc(100% - 6px)";
height: 25px;
line-height: 25px;
.usage {
height: 100%;
}
}
}
} }
/* CONTENT */ /* CONTENT */
@ -347,7 +349,8 @@ span {
flex: 1; flex: 1;
// Needed to avoid the folder's path to overflows // Needed to avoid the folder's path to overflows
// https://stackoverflow.com/questions/38223879/white-space-nowrap-breaks-flexbox-layout // https://stackoverflow.com/questions/38223879/white-space-nowrap-breaks-flexbox-layout
min-width: 0;} min-width: 0;
}
#content { #content {
box-sizing: border-box; box-sizing: border-box;
background: @content-bg; background: @content-bg;
@ -535,8 +538,10 @@ span {
padding: 0 5px; padding: 0 5px;
display: table-cell; display: table-cell;
} }
&:not(.header) {
height: @toolbar-line-height;
line-height: @toolbar-line-height;
} }
li {
&.header { &.header {
cursor: default; cursor: default;
color: @table-header-fg; color: @table-header-fg;
@ -611,7 +616,7 @@ span {
//flex-flow: row; //flex-flow: row;
z-index: 100; z-index: 100;
box-sizing: border-box; box-sizing: border-box;
height: 32px; height: @toolbar-line-height;
padding: 0; padding: 0;
display: flex; display: flex;
flex-flow: row; flex-flow: row;
@ -640,20 +645,20 @@ span {
margin: 0; margin: 0;
} }
button { button {
height: 32px; height: @toolbar-line-height;
padding: 0 10px; padding: 0 10px;
border: none; border: none;
border-radius: 0; border-radius: 0;
box-sizing: border-box; box-sizing: border-box;
background: transparent; background: transparent;
font-size: 17px; font-size: @main-font-size;
color: @toolbar-drive-color; color: @toolbar-drive-color;
transition: all 0.15s; transition: all 0.15s;
.drawer { .drawer {
display: none; display: none;
} }
.fa, span { .fa, span {
font-size: 17px; font-size: @main-font-size;
} }
&:hover { &:hover {
background: @toolbar-drive-bg; background: @toolbar-drive-bg;
@ -686,7 +691,7 @@ span {
} }
.buttonTitle { .buttonTitle {
display: inline-flex; display: inline-flex;
height: 32px; height: @toolbar-line-height;
align-items: center; align-items: center;
span:not(.fa) { span:not(.fa) {
line-height: 23px; line-height: 23px;
@ -718,8 +723,8 @@ span {
.path { .path {
flex: 1; flex: 1;
width: 100%; width: 100%;
height: 32px; height: @toolbar-line-height;
line-height: 32px; line-height: @toolbar-line-height;
cursor: default; cursor: default;
width: auto; width: auto;
overflow: hidden; overflow: hidden;
@ -729,9 +734,9 @@ span {
text-align: left; text-align: left;
.element { .element {
display: inline-block; display: inline-block;
height: 32px; height: @toolbar-line-height;
line-height: 32px; line-height: @toolbar-line-height;
font-size: 17px; font-size: @main-font-size;
padding: 0 5px; padding: 0 5px;
border: 0; border: 0;
background: darken(@toolbar-drive-bg, 10%); background: darken(@toolbar-drive-bg, 10%);

@ -161,7 +161,7 @@ define([
//var $upIcon = $('<span>', {"class": "fa fa-arrow-circle-up"}); //var $upIcon = $('<span>', {"class": "fa fa-arrow-circle-up"});
var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"}); var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"});
var $templateIcon = $('<span>', {"class": "fa fa-cubes"}); var $templateIcon = $('<span>', {"class": "fa fa-cubes"});
var $trashIcon = $('<span>', {"class": "fa fa-trash"}); var $trashIcon = $('<span>', {"class": "fa fa-trash-o"});
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"}); var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"}); //var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"});
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"}); var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"});
@ -1650,8 +1650,10 @@ define([
// and they don't hav a hierarchical structure (folder/subfolders) // and they don't hav a hierarchical structure (folder/subfolders)
var displayHrefArray = function ($container, rootName, draggable) { var displayHrefArray = function ($container, rootName, draggable) {
var unsorted = files[rootName]; var unsorted = files[rootName];
if (unsorted.length) {
var $fileHeader = getFileListHeader(false); var $fileHeader = getFileListHeader(false);
$container.append($fileHeader); $container.append($fileHeader);
}
var keys = unsorted; var keys = unsorted;
var sortBy = Cryptpad.getLSAttribute(SORT_FILE_BY); var sortBy = Cryptpad.getLSAttribute(SORT_FILE_BY);
sortBy = sortBy === "" ? sortBy = 'name' : sortBy; sortBy = sortBy === "" ? sortBy = 'name' : sortBy;
@ -2011,7 +2013,9 @@ define([
} }
$elementRow.data('path', path); $elementRow.data('path', path);
addDragAndDropHandlers($elementRow, path, true, droppable); addDragAndDropHandlers($elementRow, path, true, droppable);
if (active) { $elementRow.addClass('active'); } if (active) {
$elementRow.addClass('active');
}
return $element; return $element;
}; };
@ -2031,7 +2035,7 @@ define([
var $rootElement = createTreeElement(ROOT_NAME, $rootIcon.clone(), [ROOT], false, true, false, isRootOpened); var $rootElement = createTreeElement(ROOT_NAME, $rootIcon.clone(), [ROOT], false, true, false, isRootOpened);
$rootElement.addClass('root'); $rootElement.addClass('root');
$rootElement.find('>.element-row').contextmenu(openDirectoryContextMenu); $rootElement.find('>.element-row').contextmenu(openDirectoryContextMenu);
$('<ul>').append($rootElement).appendTo($container); $('<ul>', {'class': 'docTree'}).append($rootElement).appendTo($container);
$container = $rootElement; $container = $rootElement;
} else if (filesOp.isFolderEmpty(root)) { return; } } else if (filesOp.isFolderEmpty(root)) { return; }
@ -2061,7 +2065,7 @@ define([
var isOpened = filesOp.comparePath(path, currentPath); var isOpened = filesOp.comparePath(path, currentPath);
var $element = createTreeElement(TEMPLATE_NAME, $icon, [TEMPLATE], false, true, false, isOpened); var $element = createTreeElement(TEMPLATE_NAME, $icon, [TEMPLATE], false, true, false, isOpened);
$element.addClass('root'); $element.addClass('root');
var $list = $('<ul>', { id: 'templateTree', 'class': 'category2' }).append($element); var $list = $('<ul>', { id: 'templateTree', 'class': 'category' }).append($element);
$container.append($list); $container.append($list);
}; };
@ -2070,7 +2074,7 @@ define([
var isOpened = filesOp.comparePath(path, currentPath); var isOpened = filesOp.comparePath(path, currentPath);
var $allfilesElement = createTreeElement(FILES_DATA_NAME, $icon, [FILES_DATA], false, false, false, isOpened); var $allfilesElement = createTreeElement(FILES_DATA_NAME, $icon, [FILES_DATA], false, false, false, isOpened);
$allfilesElement.addClass('root'); $allfilesElement.addClass('root');
var $allfilesList = $('<ul>', { id: 'allfilesTree', 'class': 'category2' }).append($allfilesElement); var $allfilesList = $('<ul>', { id: 'allfilesTree', 'class': 'category' }).append($allfilesElement);
$container.append($allfilesList); $container.append($allfilesList);
}; };
@ -2080,7 +2084,7 @@ define([
var $trashElement = createTreeElement(TRASH_NAME, $icon, [TRASH], false, true, false, isOpened); var $trashElement = createTreeElement(TRASH_NAME, $icon, [TRASH], false, true, false, isOpened);
$trashElement.addClass('root'); $trashElement.addClass('root');
$trashElement.find('>.element-row').contextmenu(openTrashTreeContextMenu); $trashElement.find('>.element-row').contextmenu(openTrashTreeContextMenu);
var $trashList = $('<ul>', { id: 'trashTree', 'class': 'category2' }).append($trashElement); var $trashList = $('<ul>', { id: 'trashTree', 'class': 'category' }).append($trashElement);
$container.append($trashList); $container.append($trashList);
}; };
@ -2719,7 +2723,7 @@ define([
var userList = APP.userList = info.userList; var userList = APP.userList = info.userList;
var config = { var config = {
displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad'], displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad', 'pageTitle'],
userList: { userList: {
list: userList, list: userList,
userNetfluxId: info.myID userNetfluxId: info.myID
@ -2729,7 +2733,8 @@ define([
ifrw: window, ifrw: window,
realtime: info.realtime, realtime: info.realtime,
network: info.network, network: info.network,
$container: APP.$bar $container: APP.$bar,
pageTitle: Messages.type.drive
}; };
var toolbar = APP.toolbar = Toolbar.create(config); var toolbar = APP.toolbar = Toolbar.create(config);

@ -67,9 +67,15 @@ define([
displayed: displayed, displayed: displayed,
ifrw: ifrw, ifrw: ifrw,
common: Cryptpad, common: Cryptpad,
hideDisplayName: true, //hideDisplayName: true,
$container: $bar $container: $bar,
}; };
if (uploadMode) {
displayed.push('pageTitle');
configTb.pageTitle = Messages.upload_title;
}
var toolbar = APP.toolbar = Toolbar.create(configTb); var toolbar = APP.toolbar = Toolbar.create(configTb);
toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
@ -83,6 +89,7 @@ define([
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
var title = document.title = metadata.name; var title = document.title = metadata.name;
Title.updateTitle(title || Title.defaultTitle); Title.updateTitle(title || Title.defaultTitle);
toolbar.addElement(['pageTitle'], {pageTitle: title});
var displayFile = function (ev, sizeMb) { var displayFile = function (ev, sizeMb) {
var $mt = $dlview.find('media-tag'); var $mt = $dlview.find('media-tag');

@ -67,7 +67,7 @@ body {
} }
#friendList .friend, #messaging .header { #friendList .friend, #messaging .header {
.avatar(50px); .avatar(30px);
&.avatar { &.avatar {
display: flex; display: flex;
} }

@ -30,7 +30,7 @@
height: 300px; height: 300px;
width: 300px; width: 300px;
border: 1px solid black; border: 1px solid black;
border-radius: 10px; border-radius: 150px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
.delete { .delete {

@ -3,14 +3,15 @@ define([
'/common/cryptpad-common.js', '/common/cryptpad-common.js',
'/common/cryptget.js', '/common/cryptget.js',
'/common/mergeDrive.js', '/common/mergeDrive.js',
'/common/toolbar2.js',
'/bower_components/file-saver/FileSaver.min.js', '/bower_components/file-saver/FileSaver.min.js',
'/customize/header.js',
'less!/customize/src/less/cryptpad.less', 'less!/customize/src/less/cryptpad.less',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/customize/src/less/toolbar.less',
'less!/settings/main.less', 'less!/settings/main.less',
], function ($, Cryptpad, Crypt, Merge) { ], function ($, Cryptpad, Crypt, Merge, Toolbar) {
var saveAs = window.saveAs; var saveAs = window.saveAs;
var USERNAME_KEY = 'cryptpad.username'; var USERNAME_KEY = 'cryptpad.username';
@ -34,36 +35,45 @@ define([
}); });
}; };
// Title block var categories = {
var createTitle = function () { 'account': [
return $('<h1>').text(Messages.settings_title); 'infoBlock',
'displayName',
'languageSelector',
'logoutEverywhere',
'resetTips',
'userFeedback'
],
'drive': [
'backupDrive',
'importLocalPads',
'resetDrive'
]
}; };
var createInfoBlock = function (store) { var createInfoBlock = function (store) {
var obj = store.proxy; var obj = store.proxy;
var $div = $('<div>', {'class': 'infoBlock'}); var $div = $('<div>', {'class': 'infoBlock'});
var $account = $('<div>', {'class': 'element'}).appendTo($div);
var accountName = obj.login_name || localStorage[Cryptpad.userNameKey]; var accountName = obj.login_name || localStorage[Cryptpad.userNameKey];
var $label = $('<span>', {'class': 'label'}).text(Messages.user_accountName + ':'); var $label = $('<span>', {'class': 'label'}).text(Messages.user_accountName);
var $name = $('<span>').text(accountName || ''); var $name = $('<span>').text(accountName || '');
if (!accountName) { if (!accountName) {
$label.text(''); $label.text('');
$name.text(Messages.settings_anonymous); $name.text(Messages.settings_anonymous);
} }
$account.append($label).append($name);
$div.append($label).append($name);
var publicKey = obj.edPublic; var publicKey = obj.edPublic;
if (publicKey) { if (publicKey) {
var $key = $('<div>', {'class': 'element'}).appendTo($div);
var userHref = Cryptpad.getUserHrefFromKeys(accountName, publicKey); var userHref = Cryptpad.getUserHrefFromKeys(accountName, publicKey);
var $pubLabel = $('<span>', {'class': 'label'}) var $pubLabel = $('<span>', {'class': 'label'})
.text(Messages.settings_publicSigningKey + ':'); .text(Messages.settings_publicSigningKey);
var $pubKey = $('<input>', {type: 'text', readonly: true}) var $pubKey = $('<input>', {type: 'text', readonly: true})
.css({
width: '28em'
})
.val(userHref); .val(userHref);
$div.append('<br>').append($pubLabel).append($pubKey); $key.append($pubLabel).append($pubKey);
} }
return $div; return $div;
@ -72,14 +82,14 @@ define([
// Create the block containing the display name field // Create the block containing the display name field
var createDisplayNameInput = function (store) { var createDisplayNameInput = function (store) {
var obj = store.proxy; var obj = store.proxy;
var $div = $('<div>', {'class': 'displayName'}); var $div = $('<div>', {'class': 'displayName element'});
$('<label>', {'for' : 'displayName'}).text(Messages.user_displayName).appendTo($div); $('<label>', {'for' : 'displayName'}).text(Messages.user_displayName).appendTo($div);
$('<br>').appendTo($div); var $inputBlock = $('<div>', {'class': 'inputBlock'}).appendTo($div);
var $input = $('<input>', { var $input = $('<input>', {
'type': 'text', 'type': 'text',
'id': 'displayName', 'id': 'displayName',
'placeholder': Messages.anonymous}).appendTo($div); 'placeholder': Messages.anonymous}).appendTo($inputBlock);
var $save = $('<button>', {'class': 'btn btn-primary'}).text(Messages.settings_save).appendTo($div); var $save = $('<button>', {'class': 'btn btn-primary'}).text(Messages.settings_save).appendTo($inputBlock);
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div); var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div);
var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide().appendTo($div); var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide().appendTo($div);
@ -91,6 +101,7 @@ define([
displayName = $input.val(); displayName = $input.val();
if (displayName === obj[USERNAME_KEY]) { return; } if (displayName === obj[USERNAME_KEY]) { return; }
obj[USERNAME_KEY] = displayName; obj[USERNAME_KEY] = displayName;
Cryptpad.changeDisplayName(displayName);
$spinner.show(); $spinner.show();
Cryptpad.whenRealtimeSyncs(store.info.realtime, function () { Cryptpad.whenRealtimeSyncs(store.info.realtime, function () {
$spinner.hide(); $spinner.hide();
@ -115,11 +126,12 @@ define([
return $div; return $div;
}; };
var createResetTips = function () { var createResetTips = function () {
var $div = $('<div>', {'class': 'resetTips'}); var $div = $('<div>', {'class': 'resetTips element'});
$('<label>', {'for' : 'resetTips'}).text(Messages.settings_resetTips).appendTo($div); $('<label>', {'for' : 'resetTips'}).text(Messages.settings_resetTips).appendTo($div);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
var $button = $('<button>', {'id': 'resetTips', 'class': 'btn btn-primary'})
.text(Messages.settings_resetTipsButton).appendTo($div); .text(Messages.settings_resetTipsButton).appendTo($div);
var $button = $('<button>', {'id': 'resetTips', 'class': 'btn btn-primary'})
.text(Messages.settings_resetTipsAction).appendTo($div);
$button.click(function () { $button.click(function () {
Object.keys(localStorage).forEach(function (k) { Object.keys(localStorage).forEach(function (k) {
@ -134,7 +146,7 @@ define([
}; };
var createBackupDrive = function (store) { var createBackupDrive = function (store) {
var obj = store.proxy; var obj = store.proxy;
var $div = $('<div>', {'class': 'backupDrive'}); var $div = $('<div>', {'class': 'backupDrive element'});
var exportFile = function () { var exportFile = function () {
var sjson = JSON.stringify(obj); var sjson = JSON.stringify(obj);
@ -155,27 +167,29 @@ define([
}); });
}; };
$('<label>', {'for' : 'exportDrive'}).text(Messages.settings_backupTitle).appendTo($div); $('<label>', {'for' : 'exportDrive'}).text(Messages.settings_backupCategory).appendTo($div);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
.text(Messages.settings_backupTitle).appendTo($div);
/* add an export button */ /* add an export button */
var $export = Cryptpad.createButton('export', true, {}, exportFile); var $export = Cryptpad.createButton('export', true, {}, exportFile);
$export.addClass('btn').addClass('btn-success').append(Messages.settings_backup); $export.attr('class', 'btn btn-success').text(Messages.settings_backup);
$div.append($export); $div.append($export);
/* add an import button */ /* add an import button */
var $import = Cryptpad.createButton('import', true, {}, importFile); var $import = Cryptpad.createButton('import', true, {}, importFile);
$import.addClass('btn').addClass('btn-warning').append(Messages.settings_restore); $import.attr('class', 'btn btn-success').text(Messages.settings_restore);
$div.append($import); $div.append($import);
return $div; return $div;
}; };
var createResetDrive = function (obj) { var createResetDrive = function (obj) {
var $div = $('<div>', {'class': 'resetDrive'}); var $div = $('<div>', {'class': 'resetDrive element'});
$('<label>', {'for' : 'resetDrive'}).text(Messages.settings_resetTitle).appendTo($div); $('<label>', {'for' : 'resetDrive'}).text(Messages.settings_resetNewTitle).appendTo($div);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
var $button = $('<button>', {'id': 'resetDrive', 'class': 'btn btn-danger'})
.text(Messages.settings_reset).appendTo($div); .text(Messages.settings_reset).appendTo($div);
var $button = $('<button>', {'id': 'resetDrive', 'class': 'btn btn-danger'})
.text(Messages.settings_resetButton).appendTo($div);
$button.click(function () { $button.click(function () {
Cryptpad.prompt(Messages.settings_resetPrompt, "", function (val) { Cryptpad.prompt(Messages.settings_resetPrompt, "", function (val) {
@ -192,14 +206,16 @@ define([
}; };
var createUserFeedbackToggle = function (obj) { var createUserFeedbackToggle = function (obj) {
var $div = $('<div>', { 'class': 'userFeedback', }); var $div = $('<div>', { 'class': 'userFeedback element'});
var $label = $('<label>', { 'for': 'userFeedback'})
.text(Messages.settings_userFeedback);
$div.html('<hr />' + Messages.settings_userFeedbackHint1 + '<br />' + $('<span>', {'class': 'label'}).text(Messages.settings_userFeedbackTitle).appendTo($div);
Messages.settings_userFeedbackHint2).appendTo($div);
var $label = $('<label>', { 'for': 'userFeedback', 'class': 'noTitle' })
.text(Messages.settings_userFeedback);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
.append(Messages.settings_userFeedbackHint1)
.append(Messages.settings_userFeedbackHint2).appendTo($div);
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}); var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved});
var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}); var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'});
@ -229,25 +245,21 @@ define([
}; };
var createUsageButton = function () { var createUsageButton = function () {
var $div = $('<div>', { 'class': 'pinned-usage' })
.text(Messages.settings_usageTitle)
.append('<br>');
Cryptpad.createUsageBar(function (err, $bar) { Cryptpad.createUsageBar(function (err, $bar) {
$div.find('.limit-container').remove(); if (err) { return void console.error(err); }
$div.append($bar); APP.$usage.html('').append($bar);
}, true); }, true);
return $div;
}; };
var createLogoutEverywhere = function (obj) { var createLogoutEverywhere = function (obj) {
var proxy = obj.proxy; var proxy = obj.proxy;
var $div = $('<div>', { 'class': 'logoutEverywhere', }); var $div = $('<div>', { 'class': 'logoutEverywhere element'});
$('<label>', { 'for': 'logoutEverywhere'}) $('<label>', { 'for': 'logoutEverywhere'})
.text(Messages.settings_logoutEverywhereTitle).appendTo($div); .text(Messages.settings_logoutEverywhereTitle).appendTo($div);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
.text(Messages.settings_logoutEverywhere).appendTo($div);
var $button = $('<button>', { id: 'logoutEverywhere', 'class': 'btn btn-primary' }) var $button = $('<button>', { id: 'logoutEverywhere', 'class': 'btn btn-primary' })
.text(Messages.settings_logoutEverywhere) .text(Messages.settings_logoutEverywhereButton)
.appendTo($div); .appendTo($div);
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div); var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div);
var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide().appendTo($div); var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide().appendTo($div);
@ -279,9 +291,10 @@ define([
var createImportLocalPads = function (obj) { var createImportLocalPads = function (obj) {
if (!Cryptpad.isLoggedIn()) { return; } if (!Cryptpad.isLoggedIn()) { return; }
var $div = $('<div>', {'class': 'importLocalPads'}); var $div = $('<div>', {'class': 'importLocalPads element'});
$('<label>', {'for' : 'importLocalPads'}).text(Messages.settings_importTitle).appendTo($div); $('<label>', {'for' : 'importLocalPads'}).text(Messages.settings_import).appendTo($div);
$('<br>').appendTo($div); $('<span>', {'class': 'description'})
.text(Messages.settings_importTitle).appendTo($div);
var $button = $('<button>', {'id': 'importLocalPads', 'class': 'btn btn-primary'}) var $button = $('<button>', {'id': 'importLocalPads', 'class': 'btn btn-primary'})
.text(Messages.settings_import).appendTo($div); .text(Messages.settings_import).appendTo($div);
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div); var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide().appendTo($div);
@ -304,31 +317,90 @@ define([
}; };
var createLanguageSelector = function () { var createLanguageSelector = function () {
var $div = $('<div>', {'class': 'importLocalPads'}); var $div = $('<div>', {'class': 'languageSelector element'});
$('<label>').text(Messages.language).appendTo($div); $('<label>').text(Messages.language).appendTo($div);
$('<br>').appendTo($div);
var $b = Cryptpad.createLanguageSelector().appendTo($div); var $b = Cryptpad.createLanguageSelector().appendTo($div);
$b.find('button').addClass('btn btn-secondary'); $b.find('button').addClass('btn btn-secondary');
return $div; return $div;
}; };
var hideCategories = function () {
APP.$rightside.find('> div').hide();
};
var showCategories = function (cat) {
hideCategories();
cat.forEach(function (c) {
APP.$rightside.find('.'+c).show();
});
};
var createLeftside = function () {
var $categories = $('<div>', {'class': 'categories'}).appendTo(APP.$leftside);
APP.$usage = $('<div>', {'class': 'usage'}).appendTo(APP.$leftside);
var active = 'account';
Object.keys(categories).forEach(function (key) {
var $category = $('<div>', {'class': 'category'}).appendTo($categories);
if (key === 'account') { $category.append($('<span>', {'class': 'fa fa-user-o'})); }
if (key === 'drive') { $category.append($('<span>', {'class': 'fa fa-hdd-o'})); }
if (key === active) {
$category.addClass('active');
}
$category.click(function () {
active = key;
$categories.find('.active').removeClass('active');
$category.addClass('active');
showCategories(categories[key]);
});
$category.append(Messages['settings_cat_'+key]);
});
showCategories(categories[active]);
};
var createToolbar = function () {
var displayed = ['useradmin', 'newpad', 'limit', 'upgrade', 'pageTitle'];
var configTb = {
displayed: displayed,
ifrw: window,
common: Cryptpad,
$container: APP.$toolbar,
pageTitle: Messages.settings_title
};
var toolbar = APP.toolbar = Toolbar.create(configTb);
toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
};
var andThen = function (obj) { var andThen = function (obj) {
APP.$container.append(createTitle()); APP.$leftside = $('<div>', {id: 'leftSide'}).appendTo(APP.$container);
APP.$container.append(createInfoBlock(obj)); var $rightside = APP.$rightside = $('<div>', {id: 'rightSide'}).appendTo(APP.$container);
APP.$container.append(createDisplayNameInput(obj));
APP.$container.append(createLanguageSelector()); createToolbar();
//$rightside.append(createTitle());
$rightside.append(createInfoBlock(obj));
$rightside.append(createDisplayNameInput(obj));
$rightside.append(createLanguageSelector());
if (Cryptpad.isLoggedIn()) { if (Cryptpad.isLoggedIn()) {
APP.$container.append(createLogoutEverywhere(obj)); $rightside.append(createLogoutEverywhere(obj));
} }
APP.$container.append(createResetTips()); $rightside.append(createResetTips());
APP.$container.append(createUsageButton(obj)); $rightside.append(createBackupDrive(obj));
APP.$container.append(createBackupDrive(obj)); $rightside.append(createImportLocalPads(obj));
APP.$container.append(createImportLocalPads(obj)); $rightside.append(createResetDrive(obj));
APP.$container.append(createResetDrive(obj)); $rightside.append(createUserFeedbackToggle(obj));
APP.$container.append(createUserFeedbackToggle(obj));
obj.proxy.on('change', [], refresh); obj.proxy.on('change', [], refresh);
obj.proxy.on('remove', [], refresh); obj.proxy.on('remove', [], refresh);
Cryptpad.onDisplayNameChanged(refresh);
createLeftside();
createUsageButton();
Cryptpad.removeLoadingScreen();
}; };
$(function () { $(function () {
@ -342,6 +414,7 @@ define([
$main.removeClass('hidden'); $main.removeClass('hidden');
APP.$container = $('#container'); APP.$container = $('#container');
APP.$toolbar = $('#toolbar');
Cryptpad.ready(function () { Cryptpad.ready(function () {
//if (!Cryptpad.getUserHash()) { return redirectToMain(); } //if (!Cryptpad.getUserHash()) { return redirectToMain(); }

@ -1,31 +1,99 @@
@import '/customize/src/less/variables.less'; @import '/customize/src/less/variables.less';
@import '/customize/src/less/mixins.less';
@border: 1px solid #555; @border: 1px solid #555;
@leftside-bg: #eee;
@leftside-color: #000;
@rightside-color: #000;
@description-color: #777;
@button-width: 400px;
@button-bg: #3066e5;
@button-alt-bg: #fff;
@button-red-bg: #e54e4e;
.cp { .cp {
input[type="text"] { input[type="text"] {
padding-left: 10px; padding-left: 10px;
} }
#mainBlock {
z-index: 1;
width: 1000px;
max-width: 90%;
margin: auto;
#container { #container {
.infoBlock { font-size: 16px;
padding: 15px; display: flex;
border: @border; flex: 1;
background: @dark-base; min-height: 0;
.label { #leftSide {
color: @leftside-color;
width: 250px;
background: @leftside-bg;
display: flex;
flex-flow: column;
.categories {
flex: 1;
.category {
.leftsideCategory();
}
}
}
#rightSide {
flex: 1;
padding: 5px 20px;
color: @rightside-color;
overflow: auto;
.element {
label:not(.noTitle), .label {
display: block;
font-weight: bold; font-weight: bold;
text-decoration: underline; margin-bottom: 0;
margin-right: 5px;
} }
.description {
display: block;
color: @description-color;
margin-bottom: 5px;
} }
.displayName { margin-bottom: 20px;
input, button { }
[type="text"], button {
vertical-align: middle; vertical-align: middle;
height: 40px;
box-sizing: border-box;
}
.userFeedback {
input {
vertical-align: middle;
margin-right: 5px;
}
}
.languageSelector {
button.btn {
width: @button-width;
background-color: @button-alt-bg;
border-color: #adadad;
color: black;
&:hover {
background-color: darken(@button-alt-bg, 15%);
}
}
}
.infoBlock {
[type="text"] {
width: @button-width;
}
}
.inputBlock {
display: inline-flex;
width: @button-width;
input {
flex: 1;
border-radius: 0.25em 0 0 0.25em;
border: 1px solid #adadad;
border-right: 0px;
}
button {
border-radius: 0 0.25em 0.25em 0;
//border: 1px solid #adadad;
border-left: 0px;
} }
} }
.backupDrive { .backupDrive {
@ -36,6 +104,22 @@
margin-right: 5px; margin-right: 5px;
} }
} }
button.btn {
background-color: @button-bg;
border-color: darken(@button-bg, 10%);
color: white;
&:hover {
background-color: darken(@button-bg, 10%);
}
&.btn-danger {
background-color: @button-red-bg;
border-color: darken(@button-red-bg, 10%);
color: white;
&:hover {
background-color: darken(@button-red-bg, 10%);
}
}
}
&>div { &>div {
margin: 10px 0; margin: 10px 0;
} }

@ -230,11 +230,15 @@ define([
var $span = $('<span>', {'class': 'element'}).appendTo($container); var $span = $('<span>', {'class': 'element'}).appendTo($container);
var $inner = $('<span>').text(name); var $inner = $('<span>').text(name);
$span.append($inner).click(function () { $span.append($inner).click(function () {
var cleanName = name.replace(/[\[\]]/g, ''); var parsed = Cryptpad.parsePadUrl(data.href);
var text = '!['+cleanName+']('+data.href+')'; var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
editor.replaceSelection(text); var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
editor.replaceSelection(mt);
//var cleanName = name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.href+')';
//editor.replaceSelection(text);
$block.hide(); $block.hide();
console.log(data.href);
}); });
}); });
}; };
@ -622,12 +626,13 @@ define([
body: $iframe.find('body'), body: $iframe.find('body'),
onUploaded: function (ev, data) { onUploaded: function (ev, data) {
//var cursor = editor.getCursor(); //var cursor = editor.getCursor();
var cleanName = data.name.replace(/[\[\]]/g, ''); //var cleanName = data.name.replace(/[\[\]]/g, '');
var text = '!['+cleanName+']('+data.url+')'; //var text = '!['+cleanName+']('+data.url+')';
/*if (data.mediatag) { var parsed = Cryptpad.parsePadUrl(data.url);
text = '!'+text; var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
}*/ var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
editor.replaceSelection(text); var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
editor.replaceSelection(mt);
} }
}; };
APP.FM = Cryptpad.createFileManager(fmConfig); APP.FM = Cryptpad.createFileManager(fmConfig);

@ -279,7 +279,7 @@ div#modal #content, #print {
* { * {
.size(2.75); .size(2.75);
* { * {
font-size: 100%; font-size: 1em;
line-height: 1em; line-height: 1em;
} }
} }
@ -396,22 +396,25 @@ div#modal #content, #print {
} }
p { p {
display: flex; //display: flex;
flex-flow: column; //flex-flow: row wrap;
padding: 0; padding: 0;
margin: 0; margin: 0;
min-height:0; min-height:0;
flex: 1; min-width:0;
//flex: 1;
} }
media-tag { media-tag {
min-height: 0; min-height: 0;
flex: 1; flex: 1;
display: block; display: flex;
flex-flow: column;
text-align: center; text-align: center;
} }
media-tag img { media-tag img {
flex: 1;
max-height: 100% !important; max-height: 100% !important;
} }

Loading…
Cancel
Save