registration-optional: Allow to hide some optional registration fields
Allow to control which of the optional fields from the registration page
are being displayed to the user. Added the configuration variable
`REGISTRATION_OPTIONAL_FIELDS` to control which ones. The default value
shows all the fields as currently; to not display some of the fields,
set the configuration variable with only the fields you want to display:
```
REGISTRATION_OPTIONAL_FIELDS = [
'level_of_education',
'gender',
'year_of_birth',
'mailing_address',
'goals'
]
```
This commit is contained in:
@@ -119,6 +119,7 @@ EMAIL_USE_TLS = ENV_TOKENS.get('EMAIL_USE_TLS', False) # django default is Fals
|
||||
SITE_NAME = ENV_TOKENS['SITE_NAME']
|
||||
SESSION_ENGINE = ENV_TOKENS.get('SESSION_ENGINE', SESSION_ENGINE)
|
||||
SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN')
|
||||
REGISTRATION_OPTIONAL_FIELDS = ENV_TOKENS.get('REGISTRATION_OPTIONAL_FIELDS', REGISTRATION_OPTIONAL_FIELDS)
|
||||
|
||||
CMS_BASE = ENV_TOKENS.get('CMS_BASE', 'studio.edx.org')
|
||||
|
||||
|
||||
@@ -1044,3 +1044,14 @@ if MITX_FEATURES.get('AUTH_USE_CAS'):
|
||||
)
|
||||
INSTALLED_APPS += ('django_cas',)
|
||||
MIDDLEWARE_CLASSES += ('django_cas.middleware.CASMiddleware',)
|
||||
|
||||
###################### Registration ##################################
|
||||
|
||||
# Remove some of the fields from the list to not display them
|
||||
REGISTRATION_OPTIONAL_FIELDS = set([
|
||||
'level_of_education',
|
||||
'gender',
|
||||
'year_of_birth',
|
||||
'mailing_address',
|
||||
'goals',
|
||||
])
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
<h2 class="sr">${_("Optional Personal Information")}</h2>
|
||||
|
||||
<ol class="list-input">
|
||||
% if 'level_of_education' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<li class="field-group">
|
||||
<div class="field select" id="field-education-level">
|
||||
<label for="education-level">${_("Highest Level of Education Completed")}</label>
|
||||
@@ -195,7 +196,10 @@
|
||||
%endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
% endif
|
||||
% if 'gender' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<li class="field-group">
|
||||
<div class="field select" id="field-gender">
|
||||
<label for="gender">${_("Gender")}</label>
|
||||
<select id="gender" name="gender">
|
||||
@@ -205,7 +209,10 @@
|
||||
%endfor
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
% endif
|
||||
% if 'year_of_birth' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<li class="field-group">
|
||||
<div class="field select" id="field-yob">
|
||||
<label for="yob">${_("Year of Birth")}</label>
|
||||
<select id="yob" name="year_of_birth">
|
||||
@@ -215,6 +222,7 @@
|
||||
%endfor
|
||||
</select>
|
||||
</div>
|
||||
% endif
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
@@ -223,15 +231,19 @@
|
||||
<h2 class="sr">${_("Optional Personal Information")}</h2>
|
||||
|
||||
<ol class="list-input">
|
||||
% if 'mailing_address' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<li class="field text" id="field-address-mailing">
|
||||
<label for="address-mailing">${_("Mailing Address")}</label>
|
||||
<textarea id="address-mailing" name="mailing_address" value=""></textarea>
|
||||
</li>
|
||||
% endif
|
||||
|
||||
% if 'goals' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<li class="field text" id="field-goals">
|
||||
<label for="goals">${_("Please share with us your reasons for registering with {platform_name}").format(platform_name=settings.PLATFORM_NAME)}</label>
|
||||
<textarea id="goals" name="goals" value=""></textarea>
|
||||
</li>
|
||||
% endif
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<%namespace name='static' file='static_content.html'/>
|
||||
<%! from django.conf import settings %>
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
<%! from django_countries.countries import COUNTRIES %>
|
||||
<%! from student.models import UserProfile %>
|
||||
@@ -57,6 +58,8 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
|
||||
% if 'level_of_education' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<section class="citizenship">
|
||||
<label data-field="level_of_education" for="signup_ed_level">${_("Ed. Completed")}</label>
|
||||
<div class="input-wrapper">
|
||||
@@ -68,7 +71,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</section>
|
||||
% endif
|
||||
|
||||
% if 'gender' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<section class="gender">
|
||||
<label data-field="gender" for="signup_gender">${_("Gender")}</label>
|
||||
<div class="input-wrapper">
|
||||
@@ -80,7 +85,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</section>
|
||||
% endif
|
||||
|
||||
% if 'year_of_birth' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<section class="date-of-birth">
|
||||
<label data-field="date-of-birth" for="signup_birth_year">${_("Year of birth")}</label>
|
||||
<div class="input-wrapper">
|
||||
@@ -93,12 +100,17 @@
|
||||
##<input name="year_of_birth" type="text" placeholder="Year of birth">
|
||||
</div>
|
||||
</section>
|
||||
% endif
|
||||
|
||||
% if 'mailing_address' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<label data-field="mailing_address" for="signup_mailing_address">${_("Mailing address")}</label>
|
||||
<textarea id="signup_mailing_address" name="mailing_address"></textarea>
|
||||
% endif
|
||||
|
||||
% if 'goals' in settings.REGISTRATION_OPTIONAL_FIELDS:
|
||||
<label data-field="goals" for="signup_goals">${_("Goals in signing up for {platform_name}").format(platform_name=settings.PLATFORM_NAME)}</label>
|
||||
<textarea name="goals" id="signup_goals"></textarea>
|
||||
% endif
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user