From: Jean-Philippe Lang Date: Sun, 9 Apr 2017 09:34:24 +0000 (+0000) Subject: Introduce setting to hide optional user custom fields on registration form (#24089). X-Git-Tag: 3.4.0~139 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c2c526c822e29484ba404b9ce3ffe2accfc40b25;p=redmine.git Introduce setting to hide optional user custom fields on registration form (#24089). Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@16537 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 0cd0d8cff..ade00adfc 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 fd3c65c28..4454bbae4 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 a26e480e0..1d42b9bb5 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1032,6 +1032,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 58dad5646..a8eca2dfe 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -382,6 +382,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/locales/fr.yml b/config/locales/fr.yml index 6a2e61053..653c49bab 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -394,6 +394,7 @@ fr: setting_default_language: Langue par défaut setting_login_required: Authentification obligatoire setting_self_registration: Inscription des nouveaux utilisateurs + setting_show_custom_fields_on_registration: Afficher les champs personnalisés sur le formulaire d'inscription setting_attachment_max_size: Taille maximale des fichiers setting_issues_export_limit: Limite d'exportation des demandes setting_mail_from: Adresse d'émission diff --git a/config/settings.yml b/config/settings.yml index bf577dedb..7520d8e84 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