From 16d0527e925f640b328d5e9b21a3b1cf736b77c0 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 11 Jul 2017 15:13:39 +0200 Subject: [PATCH] Add a page title in drive, settings and file --- customize.dist/src/less/toolbar.less | 3 +++ customize.dist/translations/messages.fr.js | 3 ++- customize.dist/translations/messages.js | 3 ++- www/common/toolbar2.js | 16 ++++++++++++++++ www/drive/main.js | 5 +++-- www/file/main.js | 9 ++++++++- www/settings/main.js | 6 +++--- 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 2681247c0..cc1a1b18e 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -647,6 +647,9 @@ body .cryptpad-toolbar { line-height: 25px; white-space: nowrap; } + .pageTitle { + padding: 0 5px; + } .pencilIcon, .saveIcon { display: flex; align-items: center; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index de0af7b5c..e4f69ec45 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -9,7 +9,7 @@ define(function () { out.type.code = 'Code'; out.type.poll = 'Sondage'; out.type.slide = 'Présentation'; - out.type.drive = 'Drive'; + out.type.drive = 'CryptDrive'; out.type.whiteboard = "Tableau Blanc"; out.type.file = "Fichier"; out.type.media = "Média"; @@ -423,6 +423,7 @@ define(function () { 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.upload_title = "Hébergement de fichiers"; 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_success = "Votre fichier ({0}) a été importé avec succès et ajouté à votre CryptDrive."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 57b21decc..27495077f 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -9,7 +9,7 @@ define(function () { out.type.code = 'Code'; out.type.poll = 'Poll'; out.type.slide = 'Presentation'; - out.type.drive = 'Drive'; + out.type.drive = 'CryptDrive'; out.type.whiteboard = 'Whiteboard'; out.type.file = 'File'; out.type.media = 'Media'; @@ -435,6 +435,7 @@ define(function () { 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.upload_title = "File upload"; 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_success = "Your file ({0}) has been successfully uploaded and added to your drive."; diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index 152e37f29..ceeeb8caf 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -600,6 +600,21 @@ define([ return $titleContainer; }; + var createPageTitle = function (toolbar, config) { + if (config.title || !config.pageTitle) { return; } + var $titleContainer = $('', { + id: 'toolbarTitle', + 'class': TITLE_CLS + }).appendTo(toolbar.$top); + + var $hoverable = $('', {'class': 'hoverable'}).appendTo($titleContainer); + + // Buttons + var $text = $('', { + 'class': 'title pageTitle' + }).appendTo($hoverable).text(config.pageTitle); + }; + var createLinkToMain = function (toolbar) { var $linkContainer = $('', { 'class': "cryptpad-link" @@ -1020,6 +1035,7 @@ define([ tb['share'] = createShare; tb['fileshare'] = createFileShare; tb['title'] = createTitle; + tb['pageTitle'] = createPageTitle; tb['lag'] = createLag; tb['spinner'] = createSpinner; tb['state'] = createState; diff --git a/www/drive/main.js b/www/drive/main.js index 7aecbed58..d785cd6fc 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -2721,7 +2721,7 @@ define([ var userList = APP.userList = info.userList; var config = { - displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad'], + displayed: ['useradmin', 'spinner', 'lag', 'state', 'limit', 'newpad', 'pageTitle'], userList: { list: userList, userNetfluxId: info.myID @@ -2731,7 +2731,8 @@ define([ ifrw: window, realtime: info.realtime, network: info.network, - $container: APP.$bar + $container: APP.$bar, + pageTitle: Messages.type.drive }; var toolbar = APP.toolbar = Toolbar.create(config); diff --git a/www/file/main.js b/www/file/main.js index db094d421..71e18fbb8 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -68,8 +68,14 @@ define([ ifrw: ifrw, common: Cryptpad, hideDisplayName: true, - $container: $bar + $container: $bar, }; + + if (uploadMode) { + displayed.push('pageTitle'); + configTb.pageTitle = Messages.upload_title; + } + var toolbar = APP.toolbar = Toolbar.create(configTb); 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); } var title = document.title = metadata.name; Title.updateTitle(title || Title.defaultTitle); + toolbar.addElement(['pageTitle'], {pageTitle: title}); var displayFile = function (ev, sizeMb) { var $mt = $dlview.find('media-tag'); diff --git a/www/settings/main.js b/www/settings/main.js index c6518bba1..761c13bc2 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -5,7 +5,6 @@ define([ '/common/mergeDrive.js', '/common/toolbar2.js', '/bower_components/file-saver/FileSaver.min.js', -// '/customize/header.js', 'less!/customize/src/less/cryptpad.less', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', @@ -361,13 +360,14 @@ define([ }; var createToolbar = function () { - var displayed = ['useradmin', 'newpad', 'limit', 'upgrade']; + var displayed = ['useradmin', 'newpad', 'limit', 'upgrade', 'pageTitle']; var configTb = { displayed: displayed, ifrw: window, common: Cryptpad, hideDisplayName: true, - $container: APP.$toolbar + $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