From e755f88b6ae44a3e17248f0d6221499113c818db Mon Sep 17 00:00:00 2001 From: Weblate Date: Wed, 10 Jun 2020 12:50:35 +0200 Subject: [PATCH 1/5] Translated using Weblate (English) Currently translated at 100.0% (1283 of 1283 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1282 of 1282 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ --- www/common/translations/messages.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 637b05bef..4d47b3c7c 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1377,5 +1377,7 @@ "code_editorTheme": "Editor theme", "toolbar_file": "File", "slide_backCol": "Background color", - "slide_textCol": "Text color" + "slide_textCol": "Text color", + "support_languagesPreamble": "This server's administrators speak the following languages:", + "settings_safeLinkDefault": "Safe Links are now turned on by default. Please use the Share menu to copy links rather than your browser's address bar." } From c01f62177f01500e484d1693b925d167e4f0c74e Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 10 Jun 2020 06:57:40 -0400 Subject: [PATCH 2/5] remove some hardcoded translations --- www/common/notifications.js | 2 -- www/support/inner.js | 1 - 2 files changed, 3 deletions(-) diff --git a/www/common/notifications.js b/www/common/notifications.js index 94c2dcb15..fc72517fd 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -388,8 +388,6 @@ define([ }; handlers['SAFE_LINKS_DEFAULT'] = function (common, data) { - Messages.settings_safeLinkDefault = "SAFE LINKS ARE NOW DEFAULT"; // XXX - var content = data.content; content.getFormatText = function () { return Messages.settings_safeLinkDefault; diff --git a/www/support/inner.js b/www/support/inner.js index 3d907421d..d956914c6 100644 --- a/www/support/inner.js +++ b/www/support/inner.js @@ -149,7 +149,6 @@ define([ }) ); - Messages.support_languagesPreamble = "This server's administrators speak the following languages:"; // XXX var $div = $( h('div.cp-support-language', [ Messages.support_languagesPreamble, From 30f6e92312c2bc7b3a7d89024033ccdd63d402cb Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 10 Jun 2020 10:49:29 -0400 Subject: [PATCH 3/5] export customizable footer links for use in the 'about menu' --- customize.dist/pages.js | 38 +++++++------------- www/common/common-ui-elements.js | 60 +++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 47 deletions(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 6ba39e49a..b65faffc2 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -64,6 +64,12 @@ define([ Pages.versionString = "CryptPad v3.18.1 (Smilodon's revenge)"; + // used for the about menu + Pages.imprintLink = AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined; + Pages.privacyLink = footLink(AppConfig.privacy, 'privacy'); + Pages.githubLink = footLink('https://github.com/xwiki-labs/cryptpad', null, 'GitHub'); + Pages.faqLink = footLink('/faq.html', 'faq_link'); + Pages.infopageFooter = function () { return h('footer', [ h('div.container', [ @@ -74,24 +80,14 @@ define([ languageSelector() ]) ], ''), - /*footerCol('footer_applications', [ - footLink('/drive/', 'main_drive'), - footLink('/pad/', 'main_richText'), - footLink('/code/', 'main_code'), - footLink('/slide/', 'main_slide'), - footLink('/poll/', 'main_poll'), - footLink('/kanban/', 'main_kanban'), - footLink('/whiteboard/', null, Msg.type.whiteboard) - ]),*/ footerCol('footer_product', [ - footLink('https://cryptpad.fr/what-is-cryptpad.html', 'topbar_whatIsCryptpad'), - footLink('/faq.html', 'faq_link'), - footLink('https://github.com/xwiki-labs/cryptpad', null, 'GitHub'), + footLink('/what-is-cryptpad.html', 'topbar_whatIsCryptpad'), + Pages.faqLink, + Pages.githubLink, footLink('https://opencollective.com/cryptpad/contribute/', 'footer_donate'), ]), footerCol('footer_aboutUs', [ - /*footLink('https://blog.cryptpad.fr', 'blog'), - footLink('https://labs.xwiki.com', null, 'XWiki Labs'),*/ + /*footLink('https://blog.cryptpad.fr', 'blog'), */ footLink('http://www.xwiki.com', null, 'XWiki SAS'), footLink('https://www.open-paas.org', null, 'OpenPaaS'), footLink('/about.html', 'footer_team'), @@ -99,15 +95,9 @@ define([ ]), footerCol('footer_legal', [ footLink('/terms.html', 'footer_tos'), - footLink(AppConfig.privacy, 'privacy'), - AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined, + Pages.privacyLink, + Pages.imprintLink, ]), - /*footerCol('footer_contact', [ - footLink('https://riot.im/app/#/room/#cryptpad:matrix.org', null, 'Chat'), - footLink('https://twitter.com/cryptpad', null, 'Twitter'), - footLink('https://github.com/xwiki-labs/cryptpad', null, 'GitHub'), - footLink('/contact.html', null, 'Email') - ])*/ ]) ]), h('div.cp-version-footer', Pages.versionString) @@ -150,13 +140,9 @@ define([ h('a.navbar-brand', { href: '/index.html'}), button, h('div.collapse.navbar-collapse.justify-content-end#menuCollapse', [ - //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.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), ].concat(rightLinks)) ); }; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 4393d1201..6b433c805 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2303,29 +2303,47 @@ define([ var priv = metadataMgr.getPrivateData(); var origin = priv.origin; - Messages.help_faq = "Review our list of frequently asked questions"; // XXX - var faqLine = h('p', - h('a', { - target: '_blank', - rel: 'noreferrer noopener', - href: origin + '/faq.html', - }, Messages.help_faq) - ); - - // XXX link to the most recent changelog/release notes - // XXX FAQ - // XXX GitHub - // XXX privacy policy - // XXX legal notice - - var content = h('div', [ - // CryptPad version number + // TODO link to the most recent changelog/release notes + // https://github.com/xwiki-labs/cryptpad/releases/latest/ ? + + var note = function (content) { + return h('span.cp-info-menu-description', content); + }; + + Messages.info_imprintFlavour = "Legally mandated information about this service's operators can be found here."; // XXX + Messages.info_privacyFlavour = "Our privacy policy describes how we treat your data."; // XXX + Messages.info_faqFlavour = "Consult our FAQ for answers to common questions."; // XXX + + var template = function (line, link) { + if (!line || !link) { return; } + var p = $('

').html(line)[0]; + var model = link.cloneNode(true); + var sub = link.cloneNode(true); + +/* This is a hack to make relative URLs point to the main domain + instead of the sandbox domain. It will break if the admins have specified + some less common URL formats for their customizable links, such as if they've + used a protocal-relative absolute URL. The URL API isn't quite safe to use + because of IE (thanks, Bill). */ + var href = sub.getAttribute('href'); + if (/^\//.test(href)) { sub.setAttribute('href', origin + href); } + var a = p.querySelector('a'); + if (!a) { return; } + sub.innerText = a.innerText; + p.replaceChild(sub, a); + return p; + }; + + var legalLine = template(Messages.info_imprintFlavour, Pages.imprintLink); + var privacyLine = template(Messages.info_privacyFlavour, Pages.privacyLink); + var faqLine = template(Messages.info_faqFlavour, Pages.faqLink); + + var content = h('div.cp-info-menu-container', [ h('h6', Pages.versionString), - // First point users to our FAQ + h('hr'), + legalLine, + privacyLine, faqLine, - // Link to the support ticket form in case their - // question isn't answered by the FAQ - //supportLine, ]); var buttons = [ From 40d5acbd86500ef0ff8135b27caabd20593ebf0e Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 10 Jun 2020 11:22:00 -0400 Subject: [PATCH 4/5] remove the change display name option from the user admin menu --- www/common/common-ui-elements.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 6b433c805..f01bea6eb 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2306,10 +2306,6 @@ define([ // TODO link to the most recent changelog/release notes // https://github.com/xwiki-labs/cryptpad/releases/latest/ ? - var note = function (content) { - return h('span.cp-info-menu-description', content); - }; - Messages.info_imprintFlavour = "Legally mandated information about this service's operators can be found here."; // XXX Messages.info_privacyFlavour = "Our privacy policy describes how we treat your data."; // XXX Messages.info_faqFlavour = "Consult our FAQ for answers to common questions."; // XXX @@ -2317,7 +2313,6 @@ define([ var template = function (line, link) { if (!line || !link) { return; } var p = $('

').html(line)[0]; - var model = link.cloneNode(true); var sub = link.cloneNode(true); /* This is a hack to make relative URLs point to the main domain @@ -2435,13 +2430,14 @@ define([ } 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({ tag: 'a', attributes: {'class': config.changeNameButtonCls + ' fa fa-user'}, content: h('span', Messages.user_rename) }); - } + }*/ if (accountName && !AppConfig.disableProfile) { options.push({ tag: 'a', From 85f85a38032d1851b4d0336df44c348d931a7893 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 10 Jun 2020 11:37:39 -0400 Subject: [PATCH 5/5] reorder admin menu items --- www/common/common-ui-elements.js | 116 ++++++++++++++++--------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f01bea6eb..b469dcb9b 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2386,15 +2386,21 @@ 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 (accountName && !AppConfig.disableProfile) { + options.push({ + tag: 'a', + attributes: {'class': 'cp-toolbar-menu-profile fa fa-user-circle'}, + content: h('span', Messages.profileButton), + action: function () { + if (padType) { + window.open(origin+'/profile/'); + } else { + window.parent.location = origin+'/profile/'; + } + }, + }); + } if (padType !== 'drive' || (!accountName && priv.newSharedFolder)) { options.push({ tag: 'a', @@ -2428,30 +2434,6 @@ define([ content: h('span', Messages.type.contacts) }); } - 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({ - tag: 'a', - attributes: {'class': config.changeNameButtonCls + ' fa fa-user'}, - content: h('span', Messages.user_rename) - }); - }*/ - if (accountName && !AppConfig.disableProfile) { - options.push({ - tag: 'a', - attributes: {'class': 'cp-toolbar-menu-profile fa fa-user-circle'}, - content: h('span', Messages.profileButton), - action: function () { - if (padType) { - window.open(origin+'/profile/'); - } else { - window.parent.location = origin+'/profile/'; - } - }, - }); - } if (padType !== 'settings') { options.push({ tag: 'a', @@ -2466,6 +2448,7 @@ define([ }, }); } + 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) { @@ -2496,30 +2479,6 @@ define([ }, }); } - options.push({ tag: 'hr' }); - if (Config.allowSubscriptions) { - options.push({ - tag: 'a', - attributes: { - 'target': '_blank', - 'href': priv.plan ? priv.accounts.upgradeURL : origin+'/features.html', - 'class': 'fa fa-star-o' - }, - content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing) - }); - } - if (!priv.plan && !Config.removeDonateButton) { - options.push({ - tag: 'a', - attributes: { - 'target': '_blank', - 'rel': 'noopener', - 'href': priv.accounts.donateURL, - 'class': 'fa fa-gift' - }, - content: h('span', Messages.crowdfunding_button2) - }); - } if (AppConfig.surveyURL) { options.push({ tag: 'a', @@ -2547,6 +2506,49 @@ define([ }, }); + options.push({ + tag: 'a', + attributes: { + 'target': '_blank', + 'href': origin+'/index.html', + 'class': 'fa fa-home' + }, + content: h('span', Messages.homePage) + }); + // Add the change display name button if not in read only mode + /* + if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) { + options.push({ + tag: 'a', + attributes: {'class': config.changeNameButtonCls + ' fa fa-user'}, + content: h('span', Messages.user_rename) + }); + }*/ + options.push({ tag: 'hr' }); + if (Config.allowSubscriptions) { + options.push({ + tag: 'a', + attributes: { + 'target': '_blank', + 'href': priv.plan ? priv.accounts.upgradeURL : origin+'/features.html', + 'class': 'fa fa-star-o' + }, + content: h('span', priv.plan ? Messages.settings_cat_subscription : Messages.pricing) + }); + } + if (!priv.plan && !Config.removeDonateButton) { + options.push({ + tag: 'a', + attributes: { + 'target': '_blank', + 'rel': 'noopener', + 'href': priv.accounts.donateURL, + 'class': 'fa fa-gift' + }, + content: h('span', Messages.crowdfunding_button2) + }); + } + options.push({ tag: 'hr' }); // Add login or logout button depending on the current status if (priv.loggedIn) {