From 36ef4178dc2c6818bba5f2e6611ace92599c8bf7 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 26 Jun 2017 15:16:17 +0200 Subject: [PATCH] Remove the editable title from the file app --- customize.dist/src/less/toolbar.less | 6 ++++++ customize.dist/toolbar.css | 6 ++++++ customize.dist/translations/messages.fr.js | 1 + customize.dist/translations/messages.js | 1 + www/drive/main.js | 4 ++-- www/file/main.js | 20 +++++++++----------- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 376cfc8bd..00389004b 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -780,6 +780,9 @@ body { } .cryptpad-toolbar-leftside { height: 32px; + &:empty { + height: 0; + } float: left; margin-bottom: -1px; .cryptpad-dropdown-users { @@ -812,6 +815,9 @@ body { } .cryptpad-toolbar-rightside { height: 32px; + &:empty { + height: 0; + } text-align: right; &> button { height: 100%; diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index 7ac73423d..a7e19294f 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -1303,6 +1303,9 @@ body.app-file .cryptpad-toolbar .dropdown-bar-content p .accountData { float: left; margin-bottom: -1px; } +.cryptpad-toolbar-leftside:empty { + height: 0; +} .cryptpad-toolbar-leftside .cryptpad-dropdown-users pre { /* needed for ckeditor */ white-space: pre; @@ -1332,6 +1335,9 @@ body.app-file .cryptpad-toolbar .dropdown-bar-content p .accountData { height: 32px; text-align: right; } +.cryptpad-toolbar-rightside:empty { + height: 0; +} .cryptpad-toolbar-rightside > button { height: 100%; margin: 0; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index ed5ee0b51..179b96062 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -406,6 +406,7 @@ define(function () { out.upload_progress = "État"; out.upload_mustLogin = "Vous devez vous connecter pour importer un fichier"; out.download_button = "Déchiffrer et télécharger"; + out.download_mt_button = "Télécharger"; // general warnings out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. En savoir plus..."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index f64153742..a82ed052d 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -412,6 +412,7 @@ define(function () { out.upload_progress = "Progress"; out.upload_mustLogin = "You must be logged in to upload files"; out.download_button = "Decrypt & Download"; + out.download_mt_button = "Download"; // general warnings out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. Learn more..."; diff --git a/www/drive/main.js b/www/drive/main.js index 8908e3a8c..74ac1bb00 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -2714,6 +2714,7 @@ define([ var toolbar = APP.toolbar = Toolbar.create(config); var $rightside = toolbar.$rightside; + $rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar var $leftside = toolbar.$leftside; var $userBlock = toolbar.$userAdmin; APP.$displayName = APP.$bar.find('.' + Toolbar.constants.username); @@ -2749,8 +2750,7 @@ define([ href: window.location.origin + window.location.pathname + '#' + APP.hash }; var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig}); - $rightside.append($hist); - if (!APP.loggedIn) { $hist.hide(); } + if (APP.loggedIn) { $rightside.append($hist); } if (!readOnly && !APP.loggedIn) { var $backupButton = Cryptpad.createButton('', true).removeClass('fa').removeClass('fa-question').addClass('cryptpad-backup'); diff --git a/www/file/main.js b/www/file/main.js index 678ef4490..66a028f5d 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -60,7 +60,7 @@ define([ Title = Cryptpad.createTitle({}, function(){}, Cryptpad); - var displayed = ['title', 'useradmin', 'newpad', 'limit', 'upgrade']; + var displayed = ['useradmin', 'newpad', 'limit', 'upgrade']; if (secret && hexFileName) { displayed.push('fileshare'); } @@ -69,30 +69,24 @@ define([ displayed: displayed, ifrw: ifrw, common: Cryptpad, - title: Title.getTitleConfig(), hideDisplayName: true, $container: $bar }; var toolbar = APP.toolbar = Toolbar.create(configTb); + toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar - Title.setToolbar(toolbar); - - if (uploadMode) { toolbar.title.hide(); } - - Title.updateTitle(Cryptpad.initialName || getTitle() || Title.defaultTitle); if (!uploadMode) { var src = Cryptpad.getBlobPathFromHex(hexFileName); var cryptKey = secret.keys && secret.keys.fileKeyStr; var key = Nacl.util.decodeBase64(cryptKey); - FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) { if (e) { return void console.error(e); } var title = document.title = metadata.name; Title.updateTitle(title || Title.defaultTitle); - var displayFile = function (ev) { + var displayFile = function (ev, sizeMb) { var $mt = $dlview.find('media-tag'); var cryptKey = secret.keys && secret.keys.fileKeyStr; var hexFileName = Cryptpad.base64ToHex(secret.channel); @@ -112,6 +106,10 @@ define([ $appContainer.css('background', 'white'); } $dlButton.addClass('btn btn-success'); + var text = Messages.download_mt_button + '
'; + text += '' + Cryptpad.fixHTML(title) + '
'; + text += '' + Messages._getKey('formattedMB', [sizeMb]) + ''; + $dlButton.html(text); toolbar.$rightside.append(Cryptpad.createButton('export', true, {}, function () { saveAs(decrypted.blob, decrypted.metadata.name); @@ -169,14 +167,14 @@ define([ $dlform.show(); Cryptpad.removeLoadingScreen(); $dllabel.append($('
')); - $dllabel.append(metadata.name); + $dllabel.append(Cryptpad.fixHTML(metadata.name)); $dllabel.append($('
')); $dllabel.append(Messages._getKey('formattedMB', [sizeMb])); var decrypting = false; var onClick = function (ev) { if (decrypting) { return; } decrypting = true; - displayFile(ev); + displayFile(ev, sizeMb); }; if (sizeMb < 5) { return void onClick(); } $dlform.find('#dl, #progress').click(onClick);