From b4ef3456d9833e86c6379ebae3751f7f404f7188 Mon Sep 17 00:00:00 2001 From: Jan Cernik <66427541+jancernik@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:23:14 -0300 Subject: [PATCH] FEATURE: Allow to customize the signup form descriptions (#29959) --- .../app/components/fullname-input.gjs | 18 ++++++- .../app/components/modal/create-account.hbs | 40 +++++++------- .../app/components/modal/create-account.js | 54 ++++++++++++++++++- .../discourse/app/controllers/signup.js | 54 ++++++++++++++++++- .../discourse/app/templates/signup.hbs | 40 +++++++------- .../tests/acceptance/create-account-test.js | 30 +++++++++++ .../common/base/login-signup-page.scss | 3 ++ .../stylesheets/common/modal/login-modal.scss | 3 ++ config/locales/server.en.yml | 4 ++ config/site_settings.yml | 12 +++++ 10 files changed, 213 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/fullname-input.gjs b/app/assets/javascripts/discourse/app/components/fullname-input.gjs index 471c1e14294..7251eb95ad2 100644 --- a/app/assets/javascripts/discourse/app/components/fullname-input.gjs +++ b/app/assets/javascripts/discourse/app/components/fullname-input.gjs @@ -1,16 +1,26 @@ import Component from "@glimmer/component"; import { on } from "@ember/modifier"; +import { service } from "@ember/service"; import InputTip from "discourse/components/input-tip"; import TextField from "discourse/components/text-field"; import valueEntered from "discourse/helpers/value-entered"; export default class SidebarEditNavigationMenuTagsModal extends Component { + @service siteSettings; + get showFullname() { return ( this.siteSettings.full_name_required || this.siteSettings.enable_names ); } + get showFullnameInstructions() { + return ( + this.siteSettings.signup_form_full_name_instructions && + !this.args.nameValidation.reason + ); + } + } diff --git a/app/assets/javascripts/discourse/app/components/modal/create-account.hbs b/app/assets/javascripts/discourse/app/components/modal/create-account.hbs index 1e45eb1bf86..9a2b85478e8 100644 --- a/app/assets/javascripts/discourse/app/components/modal/create-account.hbs +++ b/app/assets/javascripts/discourse/app/components/modal/create-account.hbs @@ -55,19 +55,14 @@ - {{#if - (or - this.emailValidation.ok - (and this.emailValidationVisible this.emailValidation.reason) - ) - }} + {{#if this.showEmailValidation}} {{else}} - {{i18n "user.email.instructions"}} + {{this.emailInstructions}} {{/if}} @@ -89,10 +84,17 @@ {{i18n "user.username.title"}} - + {{#if this.showUsernameInstructions}} + + {{this.siteSettings.signup_form_username_instructions}} + + + {{else}} + + {{/if}} {{#if this.fullnameRequired}} @@ -120,7 +122,7 @@