From 60ffd1f05931ba885d758df9c31e368827926472 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 18 Jan 2021 19:30:07 +0530 Subject: [PATCH 1/2] read customizeable instance values from /api/config for the features page --- customize.dist/pages/features.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/customize.dist/pages/features.js b/customize.dist/pages/features.js index c2b693f26..a00595adf 100644 --- a/customize.dist/pages/features.js +++ b/customize.dist/pages/features.js @@ -28,7 +28,7 @@ define([ // Msg.features_f_cryptdrive0 = ""; // Msg.features_f_cryptdrive0_note = ""; // Msg.features_f_storage0 = ""; - Msg.features_f_storage0_note = "Documents are deleted after 3 months of inactivity"; + Msg.features_f_storage0_note = "Documents are deleted after {0} days of inactivity"; // Registered column Msg.features_registered = "Registered"; // // Msg.features_f_anon = ""; @@ -36,14 +36,12 @@ define([ Msg.features_f_social = "Social Features"; Msg.features_f_social_note = "Add contacts for secure collaboration, create a profile, fine-grained access controls"; // Msg.features_f_file1 = ""; - // XXX add instance limit - Msg.features_f_file1_note = "Store files in your CryptDrive: images, PDFs, videos, and more. Share them with your contacts or embed them in your documents. (up to 25MB)"; + Msg.features_f_file1_note = "Store files in your CryptDrive: images, PDFs, videos, and more. Share them with your contacts or embed them in your documents. (up to {0}MB)"; // Msg.features_f_cryptdrive1 = ""; // Msg.features_f_cryptdrive1_note = ""; // Msg.features_f_devices = ""; // Msg.features_f_devices_note = ""; - // XXX add instance limit - Msg.features_f_storage1 = "Permanent Storage (1GB)"; + Msg.features_f_storage1 = "Permanent Storage ({0}GB)"; Msg.features_f_storage1_note = "Documents stored in your CryptDrive are never deleted for inactivity"; // Premium column Msg.features_premium = "Premium"; @@ -51,7 +49,7 @@ define([ // Msg.features_f_reg = "" Msg.features_f_reg_note = "With additional benefits"; // Msg.features_f_storage2 = "" - Msg.features_f_storage2_note = "From 5GB to 50GB depending on the plan. Increased limit of 150MB for file uploads."; + Msg.features_f_storage2_note = "From 5GB to 50GB depending on the plan. Increased limit of {0}MB for file uploads."; // Msg.features_f_support = "" Msg.features_f_support_note = "Priority response from the administration team via email and built in ticket system."; Msg.features_f_supporter = "Support privacy"; @@ -85,7 +83,7 @@ define([ h('div.cp-check'), h('div.cp-content', [ h('div.cp-feature', Msg['features_f_' + f]), - h('div.cp-note', Msg['features_f_' + f + '_note']) + h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.inactiveTime])) ]) ]); }) @@ -108,8 +106,8 @@ define([ return h('li.list-group-item', [ h('div.cp-check'), h('div.cp-content', [ - h('div.cp-feature', Msg['features_f_' + f]), - h('div.cp-note', Msg['features_f_' + f + '_note']) + h('div.cp-feature', Msg._getKey('features_f_' + f, [Config.defaultStorageLimit / 1024 / 1024])), + h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.maxUploadSize / 1024 / 1024])) ]) ]); }), @@ -144,7 +142,7 @@ define([ h('div.cp-check'), h('div.cp-content', [ h('div.cp-feature', Msg['features_f_' + f]), - h('div.cp-note', Msg['features_f_' + f + '_note']) + h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.premiumUploadSize / 1024 / 1024])) ]) ]); }), From f084e94073f964bf0a09749cde26399e1170b8aa Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 19 Jan 2021 04:00:32 +0530 Subject: [PATCH 2/2] refactor features page a bit --- customize.dist/pages/features.js | 85 +++++++++++++++++++------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/customize.dist/pages/features.js b/customize.dist/pages/features.js index a00595adf..4a4950d94 100644 --- a/customize.dist/pages/features.js +++ b/customize.dist/pages/features.js @@ -67,6 +67,53 @@ define([ rel: 'noopener noreferrer' }, h('button.cp-features-register-button', Msg.features_f_subscribe)); + var groupItemTemplate = function (title, content) { + return h('li.list-group-item', [ + h('div.cp-check'), + h('div.cp-content', [ + h('div.cp-feature', title), + h('div.cp-note', content), + ]) + ]); + }; + + var defaultGroupItem = function (key) { + return groupItemTemplate( + Msg['features_f_' + key], + Msg['features_f_' + key + '_note'] + ); + }; + + var SPECIAL_GROUP_ITEMS = {}; + SPECIAL_GROUP_ITEMS.storage0 = function (f) { + return groupItemTemplate( + Msg['features_f_' + f], + Msg._getKey('features_f_' + f + '_note', [Config.inactiveTime]) + ); + }; + SPECIAL_GROUP_ITEMS.file1 = function (f) { + return groupItemTemplate( + Msg['features_f_' + f], + Msg._getKey('features_f_' + f + '_note', [Config.maxUploadSize / 1024 / 1024]) + ); + }; + SPECIAL_GROUP_ITEMS.storage1 = function (f) { + return groupItemTemplate( + Msg._getKey('features_f_' + f, [Config.defaultStorageLimit / 1024 / 1024]), + Msg['features_f_' + f + '_note'] + ); + }; + SPECIAL_GROUP_ITEMS.storage2 = function (f) { + return groupItemTemplate( + Msg['features_f_' + f], + Msg._getKey('features_f_' + f + '_note', [Config.premiumUploadSize / 1024 / 1024]) + ); + }; + + var groupItem = function (key) { + return (SPECIAL_GROUP_ITEMS[key] || defaultGroupItem)(key); + }; + var anonymousFeatures = h('div.col-12.col-sm-4.cp-anon-user',[ h('div.card',[ @@ -77,17 +124,7 @@ define([ h('div.text-center', '0€'), h('div.text-center', Msg.features_noData), ]), - h('ul.list-group.list-group-flush', - ['apps', 'file0', 'core', 'cryptdrive0', 'storage0'].map(function (f) { - return h('li.list-group-item', [ - h('div.cp-check'), - h('div.cp-content', [ - h('div.cp-feature', Msg['features_f_' + f]), - h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.inactiveTime])) - ]) - ]); - }) - ), + h('ul.list-group.list-group-flush', ['apps', 'file0', 'core', 'cryptdrive0', 'storage0'].map(groupItem)), ]), ]); @@ -101,17 +138,7 @@ define([ 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', [ - h('div.cp-check'), - h('div.cp-content', [ - h('div.cp-feature', Msg._getKey('features_f_' + f, [Config.defaultStorageLimit / 1024 / 1024])), - h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.maxUploadSize / 1024 / 1024])) - ]) - ]); - }), - ]), + h('ul.list-group.list-group-flush', ['anon', 'social', 'file1', 'cryptdrive1', 'devices', 'storage1'].map(groupItem)), h('div.card-body',[ h('div.cp-features-register#cp-features-register', [ h('a', { @@ -134,19 +161,7 @@ define([ }, 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) { - console.log('features_f_' + f); - console.log('features_f_' + f + '_note'); - return h('li.list-group-item', [ - h('div.cp-check'), - h('div.cp-content', [ - h('div.cp-feature', Msg['features_f_' + f]), - h('div.cp-note', Msg._getKey('features_f_' + f + '_note', [Config.premiumUploadSize / 1024 / 1024])) - ]) - ]); - }), - ]), + h('ul.list-group.list-group-flush', ['reg', 'storage2', 'support', 'supporter'].map(groupItem)), h('div.card-body',[ h('div.cp-features-register#cp-features-subscribe', [ premiumButton