From 9104441eb2a6d8c88ad236ce3e8c68b6ec908f45 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 25 Jun 2021 11:58:05 +0530 Subject: [PATCH] prototype instance purpose radio selection --- www/admin/app-admin.less | 11 ++++++++ www/admin/inner.js | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 17450361c..227792540 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -203,6 +203,17 @@ } } + .cp-admin-radio-container { + display: flex; + align-items: left; //center; + flex-wrap: wrap; + flex-direction: column; + label { + margin-right: 40px; + margin-top: 5px; + } + } + .cp-admin-broadcast-form { input.flatpickr-input { width: 307.875px !important; // same width as flatpickr calendar diff --git a/www/admin/inner.js b/www/admin/inner.js index f8bcad681..883db0f84 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -94,6 +94,7 @@ define([ 'cp-admin-list-my-instance', 'cp-admin-consent-to-contact', 'cp-admin-remove-donate-button', + 'cp-admin-instance-purpose', // XXX ], }; @@ -1853,6 +1854,60 @@ define([ }, }); + Messages.admin_instancePurposeTitle = "Instance purpose"; // XXX + Messages.admin_instancePurposeHint = "Why do you run this instance? Your answer will be shared with the developers unless you have disabled telemetry"; // XXX + + Messages.admin_purpose_noanswer = "I prefer not to answer"; // XXX + Messages.admin_purpose_experiment = "To test the CryptPad platform"; // XXX + Messages.admin_purpose_development = "To develop new features for CryptPad"; // XXX + + Messages.admin_purpose_personal = "For myself, family, and friends"; // XXX + + Messages.admin_purpose_business = "For my business's external use"; // XXX + Messages.admin_purpose_intranet = "For my business's internal use"; // XXX + + Messages.admin_purpose_school = "For my school, college, or university"; // XXX + Messages.admin_purpose_org = "For a non-profit organization or advocacy group"; // XXX + + Messages.admin_purpose_commercial = "To provide a commercial service"; // XXX + Messages.admin_purpose_public = "To provide a free service"; // XXX + + create['instance-purpose'] = function () { + var key = 'instance-purpose'; + var $div = makeBlock(key); + + var values = [ + 'noanswer', + 'development', + 'experiment', + 'personal', + 'business', // as a public resource for my business clients + 'intranet', // for my business's _internal use_ + 'school', + 'org', + 'commercial', + 'public', // to provide a free service (for the public) + ]; + + var defaultPurpose = 'noanswer'; + var purpose = defaultPurpose; + + var opts = h('div.cp-admin-radio-container', [ + values.map(function (key) { + var full_key = 'admin_purpose_' + key; + return UI.createRadio('cp-instance-purpose-radio', 'cp-instance-purpose-radio-'+key, + Messages[full_key] || Messages._getKey(full_key, [defaultPurpose]), + key === purpose, { + input: { value: key }, + label: { class: 'noTitle' } + }); + }) + ]); + + $div.append(opts); + return $div; + }; + var hideCategories = function () { APP.$rightside.find('> div').hide(); };