Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customizing student account options and settings #791

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/djangoapps/student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class Meta:

# Optional demographic data we started capturing from Fall 2012
this_year = datetime.now(UTC).year
VALID_YEARS = list(range(this_year, this_year - 120, -1))
VALID_YEARS = range(this_year - 16, this_year - 120, -1)
year_of_birth = models.IntegerField(blank=True, null=True, db_index=True)
GENDER_CHOICES = (
('m', gettext_noop('Male')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ define(['backbone',

var sectionsData = accountSettingsView.options.tabSections.aboutTabSections;

expect(sectionsData[0].fields.length).toBe(7);
expect(sectionsData[0].fields.length).toBe(6);

var textFields = [sectionsData[0].fields[1], sectionsData[0].fields[2]];
for (i = 0; i < textFields.length; i++) {
Expand Down Expand Up @@ -185,10 +185,9 @@ define(['backbone',
USERNAME: 0,
FULL_NAME: 1,
EMAIL_ADDRESS: 2,
PASSWORD: 3,
LANGUAGE: 4,
COUNTRY: 5,
TIMEZONE: 6
LANGUAGE: 3,
COUNTRY: 4,
TIMEZONE: 5
};
var additionalInfoFields = {
EDUCATION: 0,
Expand Down Expand Up @@ -276,7 +275,7 @@ define(['backbone',

sectionsData = accountSettingsView.options.tabSections.aboutTabSections;

expect(sectionsData[accountInfoTab.BASIC_ACCOUNT_INFORMATION].fields.length).toBe(7);
expect(sectionsData[accountInfoTab.BASIC_ACCOUNT_INFORMATION].fields.length).toBe(6);

// Verify that username, name and email fields are readonly
textFields = [
Expand Down
27 changes: 14 additions & 13 deletions lms/static/js/student_account/views/account_settings_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,20 @@
},
fullnameFieldView,
emailFieldView,
{
view: new AccountSettingsFieldViews.PasswordFieldView({
model: userAccountModel,
title: gettext('Password'),
screenReaderTitle: gettext('Reset Your Password'),
valueAttribute: 'password',
emailAttribute: 'email',
passwordResetSupportUrl: passwordResetSupportUrl,
linkTitle: gettext('Reset Your Password'),
linkHref: fieldsData.password.url,
helpMessage: gettext('Check your email account for instructions to reset your password.') // eslint-disable-line max-len
})
},
// {
// view: new AccountSettingsFieldViews.PasswordFieldView({
// model: userAccountModel,
// title: gettext('Password'),
// screenReaderTitle: gettext('Reset Your Password'),
// valueAttribute: 'password',
// emailAttribute: 'email',
// passwordResetSupportUrl: passwordResetSupportUrl,
// linkTitle: gettext('Reset Your Password'),
// linkHref: fieldsData.password.url,
// eslint-disable-next-line max-len
// helpMessage: gettext('Check your email account for instructions to reset your password.')
// })
// },
{
view: new AccountSettingsFieldViews.LanguagePreferenceFieldView({
model: userPreferencesModel,
Expand Down
16 changes: 8 additions & 8 deletions lms/static/js/student_account/views/account_settings_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
selected: true,
expanded: true
},
{
name: 'accountsTabSections',
id: 'accounts-tab',
label: gettext('Linked Accounts'),
tabindex: -1,
selected: false,
expanded: false
}
// {
// name: 'accountsTabSections',
// id: 'accounts-tab',
// label: gettext('Linked Accounts'),
// tabindex: -1,
// selected: false,
// expanded: false
// }
];
if (!view.options.disableOrderHistoryTab) {
accountSettingsTabs.push({
Expand Down
6 changes: 3 additions & 3 deletions openedx/core/djangoapps/user_api/accounts/settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ def account_settings_context(request):
'nav_hidden': True,
'fields': {
'country': {
'options': list(countries),
'options': [(u'UY', u'Uruguay')], # For all options use list(countries)
}, 'gender': {
'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES], # lint-amnesty, pylint: disable=translation-of-non-string
}, 'language': {
'options': released_languages(),
'options': [(u'es-419', u'Español (Latinoamérica)')], # For all options use released_languages(),
}, 'level_of_education': {
'options': [(choice[0], _(choice[1])) for choice in UserProfile.LEVEL_OF_EDUCATION_CHOICES], # lint-amnesty, pylint: disable=translation-of-non-string
}, 'password': {
'url': reverse('password_reset'),
}, 'year_of_birth': {
'options': year_of_birth_options,
}, 'preferred_language': {
'options': all_languages(),
'options': [(u'es-419', u'Español (Latinoamérica)')], # For all options use all_languages()
}, 'time_zone': {
'options': TIME_ZONE_CHOICES,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def test_register_form_year_of_birth(self):
"name": str(year),
"default": False
}
for year in range(this_year, this_year - 120, -1)
for year in range(this_year - 16, this_year - 120, -1)
]
)
self._assert_reg_field(
Expand Down
Loading