From 0422b791242c3facc4a425266b6a873ca9740871 Mon Sep 17 00:00:00 2001 From: Jan Schulz-Hofen Date: Fri, 14 Oct 2016 12:00:08 +0200 Subject: [PATCH 1/3] Introduce setting to hide optional user custom fields on registration form to improve conversion --- app/views/account/register.html.erb | 2 +- app/views/settings/_authentication.html.erb | 7 ++++++- config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/settings.yml | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 0cd0d8c..ade00ad 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -29,7 +29,7 @@

<%= f.text_field :identity_url %>

<% end %> -<% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %> +<% @user.custom_field_values.select {|v| (Setting.show_custom_fields_on_registration? && v.editable?) || v.required?}.each do |value| %>

<%= custom_field_tag_with_label :user, value %>

<% end %> diff --git a/app/views/settings/_authentication.html.erb b/app/views/settings/_authentication.html.erb index 1536781..4eda969 100644 --- a/app/views/settings/_authentication.html.erb +++ b/app/views/settings/_authentication.html.erb @@ -8,7 +8,12 @@

<%= setting_select :self_registration, [[l(:label_disabled), "0"], [l(:label_registration_activation_by_email), "1"], [l(:label_registration_manual_activation), "2"], - [l(:label_registration_automatic_activation), "3"]] %>

+ [l(:label_registration_automatic_activation), "3"]], + :onchange => + "if (this.value != '0') { $('#settings_show_custom_fields_on_registration').removeAttr('disabled'); } else { $('#settings_show_custom_fields_on_registration').attr('disabled', true); }" %>

+ +

<%= setting_check_box :show_custom_fields_on_registration, + :disabled => !Setting.self_registration? %>

<%= setting_check_box :unsubscribe %>

diff --git a/config/locales/de.yml b/config/locales/de.yml index 5bdb484..8781e9f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1038,6 +1038,7 @@ de: setting_repository_log_display_limit: Maximale Anzahl anzuzeigender Revisionen in der Historie einer Datei setting_rest_api_enabled: REST-Schnittstelle aktivieren setting_self_registration: Registrierung ermöglichen + setting_show_custom_fields_on_registration: Benutzerdefinierte Felder bei der Registrierung abfragen setting_sequential_project_identifiers: Fortlaufende Projektkennungen generieren setting_session_lifetime: Längste Dauer einer Sitzung setting_session_timeout: Zeitüberschreitung bei Inaktivität diff --git a/config/locales/en.yml b/config/locales/en.yml index 56a06c7..54eb127 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -372,6 +372,7 @@ en: setting_default_language: Default language setting_login_required: Authentication required setting_self_registration: Self-registration + setting_show_custom_fields_on_registration: Show custom fields on registration setting_attachment_max_size: Maximum attachment size setting_issues_export_limit: Issues export limit setting_mail_from: Emission email address diff --git a/config/settings.yml b/config/settings.yml index 807f9b7..7f70a17 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -31,6 +31,8 @@ login_required: self_registration: default: '2' security_notifications: 1 +show_custom_fields_on_registration: + default: 1 lost_password: default: 1 security_notifications: 1 -- 2.7.2