From 3c6e1278310b4c274990656bf936f5070812f679 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Aug 2019 18:04:11 +0200 Subject: [PATCH 01/14] Improve upload table UI --- customize.dist/src/less2/include/fileupload.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/fileupload.less b/customize.dist/src/less2/include/fileupload.less index 8871eb6af..ebe93399b 100644 --- a/customize.dist/src/less2/include/fileupload.less +++ b/customize.dist/src/less2/include/fileupload.less @@ -68,7 +68,7 @@ } } .cp-fileupload-table-progress { - min-width: 8em; + min-width: 12em; max-width: 16em; position: relative; text-align: center; From ae1e221bdc458d06ba58ddfc5b6fd74b1730a6cb Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Aug 2019 18:04:34 +0200 Subject: [PATCH 02/14] Remove useless X in the download table --- www/common/sframe-common-file.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index 3956c60a6..4958cce1f 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -533,8 +533,7 @@ define([ createUploader(config.dropArea, config.hoverArea, config.body); - // XXX an X is still displayed when downloading, even though we can't cancel (at the moment) - // XXX implement the abiality to cancel downloads :D + // TODO implement the ability to cancel downloads :D var updateProgressbar = function (file, data, downloadFunction, cb) { if (queue.inProgress) { return; } queue.inProgress = true; @@ -625,10 +624,10 @@ define([ }); */ -/* $row.find('.cp-fileupload-table-cancel') .html('') - .append($cancel); */ + .append(h('span.fa.fa-minus')); + //.append($cancel); }; File.downloadFile = function (fData, cb) { From 74372ba5d4dc8df5a94a9fb4376ea65f3b4bef2b Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Aug 2019 12:16:48 +0200 Subject: [PATCH 03/14] Disable Ctrl+E modal in share and filepicker modals --- www/common/sframe-common.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 82c71ace2..c6a56c14d 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -505,7 +505,7 @@ define([ }; var shortcuts = []; - funcs.addShortcuts = function (w) { + funcs.addShortcuts = function (w, isApp) { w = w || window; if (shortcuts.indexOf(w) !== -1) { return; } shortcuts.push(w); @@ -513,7 +513,7 @@ define([ // Ctrl || Meta (mac) if (e.ctrlKey || (navigator.platform === "MacIntel" && e.metaKey)) { // Ctrl+E: New pad modal - if (e.which === 69) { + if (e.which === 69 && isApp) { e.preventDefault(); return void funcs.createNewPadModal(); } @@ -619,22 +619,24 @@ define([ ctx.metadataMgr.onReady(waitFor()); - funcs.addShortcuts(); }).nThen(function () { + var privateData = ctx.metadataMgr.getPrivateData(); + funcs.addShortcuts(window, Boolean(privateData.app)); + try { - var feedback = ctx.metadataMgr.getPrivateData().feedbackAllowed; + var feedback = privateData.feedbackAllowed; Feedback.init(feedback); } catch (e) { Feedback.init(false); } try { - var forbidden = ctx.metadataMgr.getPrivateData().disabledApp; + var forbidden = privateData.disabledApp; if (forbidden) { UI.alert(Messages.disabledApp, function () { funcs.gotoURL('/drive/'); }, {forefront: true}); return; } - var mustLogin = ctx.metadataMgr.getPrivateData().registeredOnly; + var mustLogin = privateData.registeredOnly; if (mustLogin) { UI.alert(Messages.mustLogin, function () { funcs.setLoginRedirect(function () { @@ -648,7 +650,7 @@ define([ } try { - window.CP_DEV_MODE = ctx.metadataMgr.getPrivateData().devMode; + window.CP_DEV_MODE = privateData.devMode; } catch (e) {} ctx.sframeChan.on('EV_LOGOUT', function () { @@ -658,7 +660,7 @@ define([ } }); UI.addLoadingScreen({hideTips: true}); - var origin = ctx.metadataMgr.getPrivateData().origin; + var origin = privateData.origin; var href = origin + "/login/"; var onLogoutMsg = Messages._getKey('onLogout', ['', '']); UI.errorLoadingScreen(onLogoutMsg, true); From c95db3315796d1bcb1be3f505068c4033b64d098 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Aug 2019 16:19:45 +0200 Subject: [PATCH 04/14] Improve pricing visibility --- customize.dist/messages.js | 3 ++- customize.dist/pages.js | 2 +- customize.dist/pages/features.js | 22 +++++++++++++++++-- .../src/less2/pages/page-features.less | 6 +++++ www/common/common-ui-elements.js | 21 ++++++++++++++++++ 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 7fa088c43..fdbe2ee7e 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -26,7 +26,8 @@ var getLanguage = messages._getLanguage = function () { var l = getBrowserLanguage(); // Edge returns 'fr-FR' --> transform it to 'fr' and check again return map[l] ? l : - (map[l.split('-')[0]] ? l.split('-')[0] : 'en'); + (map[l.split('-')[0]] ? l.split('-')[0] : + (map[l.split('_')[0]] ? l.split('_')[0] : 'en')); }; var language = getLanguage(); diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 3fd5e63bb..559c16e02 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -146,7 +146,7 @@ define([ //h('a.nav-item.nav-link', { href: '/what-is-cryptpad.html'}, Msg.topbar_whatIsCryptpad), // Moved the FAQ //h('a.nav-item.nav-link', { href: '/faq.html'}, Msg.faq_link), h('a.nav-item.nav-link', { href: 'https://blog.cryptpad.fr/'}, Msg.blog), - h('a.nav-item.nav-link', { href: '/features.html'}, Msg.features), + h('a.nav-item.nav-link', { href: '/features.html'}, Msg.pricing), h('a.nav-item.nav-link', { href: '/privacy.html'}, Msg.privacy), //h('a.nav-item.nav-link', { href: '/contact.html'}, Msg.contact), //h('a.nav-item.nav-link', { href: '/about.html'}, Msg.about), diff --git a/customize.dist/pages/features.js b/customize.dist/pages/features.js index ec6adfa6f..1d90eecb6 100644 --- a/customize.dist/pages/features.js +++ b/customize.dist/pages/features.js @@ -21,14 +21,17 @@ define([ target: '_blank', rel: 'noopener noreferrer' }, h('button.cp-features-register-button', Msg.features_f_subscribe)); - $(premiumButton).click(function (e) { + /*$(premiumButton).click(function (e) { if (LocalStore.isLoggedIn()) { return; } // Not logged in: go to /login with a redirect to this page e.preventDefault(); e.stopPropagation(); sessionStorage.redirectTo = '/features.html'; window.location.href = '/login/'; - }); + });*/ + Msg.features_emailRequired = 'Email address required'; + Msg.features_noData = 'No personal data required'; + Msg.features_pricing = '{0}, {1} or {2}€/month'; return h('div#cp-main', [ Pages.infopageTopbar(), h('div.container-fluid.cp_cont_features',[ @@ -43,6 +46,10 @@ define([ h('div.card-body',[ h('h3.text-center',Msg.features_anon) ]), + h('div.card-body.cp-pricing',[ + h('div.text-center', '0€'), + h('div.text-center', Msg.features_noData), + ]), h('ul.list-group.list-group-flush', ['apps', 'core', 'file0', 'cryptdrive0', 'storage0'].map(function (f) { return h('li.list-group-item', [ @@ -61,6 +68,10 @@ define([ h('div.card-body',[ h('h3.text-center',Msg.features_registered) ]), + h('div.card-body.cp-pricing',[ + h('div.text-center', '0€'), + h('div.text-center', Msg.features_noData), + ]), h('ul.list-group.list-group-flush', [ ['anon', 'social', 'file1', 'cryptdrive1', 'devices', 'storage1'].map(function (f) { return h('li.list-group-item', [ @@ -87,6 +98,13 @@ define([ h('div.card-body',[ h('h3.text-center',Msg.features_premium) ]), + h('div.card-body.cp-pricing',[ + h('div.text-center', h('a', { + href: accounts.upgradeURL, + target: '_blank' + }, Msg._getKey('features_pricing', ['5', '10', '15']))), + h('div.text-center', Msg.features_emailRequired), + ]), h('ul.list-group.list-group-flush', [ ['reg', 'storage2', 'support', 'supporter'].map(function (f) { return h('li.list-group-item', [ diff --git a/customize.dist/src/less2/pages/page-features.less b/customize.dist/src/less2/pages/page-features.less index e5e68e7d7..0268f5869 100644 --- a/customize.dist/src/less2/pages/page-features.less +++ b/customize.dist/src/less2/pages/page-features.less @@ -47,6 +47,12 @@ h3 { margin: 0; } + &.cp-pricing { + div { + font-size: 1.2em; + color: @cryptpad_color_blue; + } + } } } h3 { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 3b6c294bb..ee4ab98b5 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1859,6 +1859,15 @@ define([ content: $userAdminContent.html() }); } + options.push({ + tag: 'a', + attributes: { + 'target': '_blank', + 'href': origin+'/index.html', + 'class': 'fa fa-home' + }, + content: h('span', Messages.homePage) + }); if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) { options.push({ tag: 'a', @@ -1870,6 +1879,7 @@ define([ content: h('span', Messages.login_accessDrive) }); } + options.push({ tag: 'hr' }); // Add the change display name button if not in read only mode if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) { options.push({ @@ -1892,6 +1902,7 @@ define([ content: h('span', Messages.settingsButton) }); } + options.push({ tag: 'hr' }); // Add administration panel link if the user is an admin if (priv.edPublic && Array.isArray(Config.adminKeys) && Config.adminKeys.indexOf(priv.edPublic) !== -1) { options.push({ @@ -1907,6 +1918,16 @@ define([ content: h('span', Messages.supportPage || 'Support') }); } + options.push({ + tag: 'a', + attributes: { + 'target': '_blank', + 'href': origin+'/features.html', + 'class': 'fa fa-star-o' + }, + content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing) + }); + options.push({ tag: 'hr' }); // Add login or logout button depending on the current status if (accountName) { options.push({ From 753ba8598313f45c50086cf1fd4b113349c21800 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 23 Aug 2019 14:19:56 +0000 Subject: [PATCH 05/14] Translated using Weblate (English) Currently translated at 100.0% (1041 of 1041 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1040 of 1040 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1039 of 1039 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ --- www/common/translations/messages.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 73c6bb8c3..bee205c59 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -322,7 +322,7 @@ "fm_newButtonTitle": "Create a new pad or folder, import a file in the current folder", "fm_newFolder": "New folder", "fm_newFile": "New pad", - "fm_morePads": "More pads", + "fm_morePads": "More", "fm_folder": "Folder", "fm_sharedFolder": "Shared folder", "fm_folderName": "Folder name", @@ -1134,5 +1134,7 @@ "requestEdit_accepted": "{1} granted you edit rights for the pad {0}", "requestEdit_sent": "Request sent", "uploadFolderButton": "Upload folder", - "properties_unknownUser": "{0} unknown user(s)" + "properties_unknownUser": "{0} unknown user(s)", + "pricing": "Pricing", + "homePage": "Home page" } From eabe639e7cacba9ad188e5b53c0c7d0adcf64bc3 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 23 Aug 2019 14:19:56 +0000 Subject: [PATCH 06/14] Translated using Weblate (French) Currently translated at 100.0% (1041 of 1041 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/fr/ Translated using Weblate (French) Currently translated at 99.9% (1038 of 1039 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/fr/ --- www/common/translations/messages.fr.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index 73a198238..7295f1f39 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1126,13 +1126,15 @@ "requestEdit_sent": "Demande envoyée", "uploadFolderButton": "Importer un dossier", "properties_unknownUser": "{0} utilisateur(s) inconnu(s)", - "fm_morePads": "Plus de pads", + "fm_morePads": "Plus", "fc_openInCode": "Ouvrir dans l'application Code", "uploadFolder_modal_title": "Options d'importation du dossier", "uploadFolder_modal_filesPassword": "Mot de passe des fichiers", "uploadFolder_modal_owner": "Être propriétaire des fichiers", "uploadFolder_modal_forceSave": "Stocker les fichiers dans votre CryptDrive", - "convertFolderToSF_SFParent": "Impossible de convertir ce dossier en dossier partagé car il se situe à l'interieur d'un autre dossier partagé. Veuillez le déplacer à l'extérieur afin de continuer.", + "convertFolderToSF_SFParent": "Impossible de convertir ce dossier en dossier partagé car il se situe à l'intérieur d'un autre dossier partagé. Veuillez le déplacer à l'extérieur afin de continuer.", "convertFolderToSF_SFChildren": "Impossible de convertir ce dossier en dossier partagé car il contient déjà d'autres dossiers partagés. Veuillez déplacer ces dossiers à l'extérieur afin de continuer.", - "convertFolderToSF_confirm": "Ce dossier va être converti en dossier partagé afin de pouvoir être accessible par d'autres utilisateurs. Continuer ?" + "convertFolderToSF_confirm": "Ce dossier va être converti en dossier partagé afin de pouvoir être accessible par d'autres utilisateurs. Continuer ?", + "pricing": "Tarification", + "homePage": "Page d'accueil" } From e4ecf02774c362bf7ba52f82455561379dbfb208 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 23 Aug 2019 14:19:56 +0000 Subject: [PATCH 07/14] Translated using Weblate (German) Currently translated at 100.0% (1039 of 1039 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ Translated using Weblate (German) Currently translated at 100.0% (1039 of 1039 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ --- www/common/translations/messages.de.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index 208363e60..a3380ca72 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1124,5 +1124,14 @@ "requestEdit_accepted": "{1} hat dir Bearbeitungsrechte für das Pad {0} gegeben", "requestEdit_sent": "Anfrage gesendet", "uploadFolderButton": "Ordner hochladen", - "properties_unknownUser": "{0} unbekannte(r) Benutzer" + "properties_unknownUser": "{0} unbekannte(r) Benutzer", + "fm_morePads": "Mehr", + "fc_openInCode": "Im Code-Editor öffnen", + "uploadFolder_modal_title": "Optionen für Ordnerupload", + "uploadFolder_modal_filesPassword": "Passwort für Dateien", + "uploadFolder_modal_owner": "Eigene Dateien", + "uploadFolder_modal_forceSave": "Dateien im CryptDrive speichern", + "convertFolderToSF_SFParent": "Dieser Ordner kann an seinem aktuellen Ort nicht einen geteilten Ordner umgewandelt werden. Verschiebe ihn zunächst aus dem übergeordneten geteilten Ordner heraus.", + "convertFolderToSF_SFChildren": "Dieser Ordner kann nicht in einen geteilten Ordner umgewandelt werden, weil er bereits geteilte Ordner enthält. Verschiebe diese geteilten Ordner zunächst an einen anderen Ort.", + "convertFolderToSF_confirm": "Dieser Ordner muss in einen geteilten Ordner umgewandelt werden, damit ihn andere sehen können. Fortfahren?" } From e3e4186f34aaef4037ef4043c82c19d6607c33f1 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Aug 2019 16:20:50 +0200 Subject: [PATCH 08/14] Remove placeholder --- customize.dist/pages/features.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/customize.dist/pages/features.js b/customize.dist/pages/features.js index 1d90eecb6..07aed6367 100644 --- a/customize.dist/pages/features.js +++ b/customize.dist/pages/features.js @@ -29,9 +29,6 @@ define([ sessionStorage.redirectTo = '/features.html'; window.location.href = '/login/'; });*/ - Msg.features_emailRequired = 'Email address required'; - Msg.features_noData = 'No personal data required'; - Msg.features_pricing = '{0}, {1} or {2}€/month'; return h('div#cp-main', [ Pages.infopageTopbar(), h('div.container-fluid.cp_cont_features',[ From 7816c17cb54ef9d5b00e24e235d2121efb3304a4 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Aug 2019 16:31:57 +0200 Subject: [PATCH 09/14] Fix backspace shortcut in codemirror --- www/common/sframe-common-codemirror.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index f910f12b6..6174e3a4c 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -416,8 +416,12 @@ define([ "Backspace": function () { var cursor = doc.getCursor(); var line = doc.getLine(cursor.line); - if (line.substring(0, cursor.ch).trim() === "") { editor.execCommand("indentLess"); } - else { editor.execCommand("delCharBefore"); } + var beforeCursor = line.substring(0, cursor.ch); + if (beforeCursor && beforeCursor.trim() === "") { + editor.execCommand("indentLess"); + } else { + editor.execCommand("delCharBefore"); + } }, }); From c7ca50c9341199d90705f5b04ae12da6c1efb31e Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Aug 2019 16:42:31 +0200 Subject: [PATCH 10/14] add "copy shareable link" button to "profile" page --- www/profile/app-profile.less | 6 +++++- www/profile/inner.js | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/www/profile/app-profile.less b/www/profile/app-profile.less index 852b11421..1284f31c4 100644 --- a/www/profile/app-profile.less +++ b/www/profile/app-profile.less @@ -122,9 +122,13 @@ #cp-app-profile-invite-button { float: right; } - #cp-app-profile-viewprofile-button { + .cp-app-profile-viewprofile-button { margin-bottom: 20px; float: right; + margin-left: 5px; + &> span { + margin-left: 10px; + } } #cp-app-profile-description { position: relative; diff --git a/www/profile/inner.js b/www/profile/inner.js index 75f1022f8..324e918a8 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -9,6 +9,7 @@ define([ '/common/common-interface.js', '/common/common-ui-elements.js', '/common/common-realtime.js', + '/common/clipboard.js', '/common/hyperscript.js', '/customize/messages.js', '/customize/application_config.js', @@ -36,6 +37,7 @@ define([ UI, UIElements, Realtime, + Clipboard, h, Messages, AppConfig, @@ -96,15 +98,20 @@ define([ var hash = common.getMetadataMgr().getPrivateData().hashes.viewHash; var url = APP.origin + '/profile/#' + hash; - var $button = $('