Merge pull request #7817 from edx/rc-microsite-fixes
Microsite fixes for accounts and learner profiles
This commit is contained in:
@@ -387,8 +387,8 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
|
||||
Then `about me` field mode should be `edit`
|
||||
"""
|
||||
placeholder_value = (
|
||||
"Tell other edX learners a little about yourself: where you live, what your interests are, "
|
||||
"why you're taking courses on edX, or what you hope to learn."
|
||||
"Tell other learners a little about yourself: where you live, what your interests are, "
|
||||
"why you're taking courses, or what you hope to learn."
|
||||
)
|
||||
|
||||
username, user_id = self.log_in_as_unique_user()
|
||||
|
||||
@@ -12,6 +12,8 @@ from django.views.decorators.http import require_http_methods
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.models import User
|
||||
|
||||
from microsite_configuration import microsite
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
||||
@@ -81,6 +83,7 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff)
|
||||
'own_profile': (logged_in_username == profile_username),
|
||||
'country_options': country_options,
|
||||
'language_options': settings.ALL_LANGUAGES,
|
||||
'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -601,9 +601,10 @@ if FEATURES.get('INDIVIDUAL_DUE_DATES'):
|
||||
|
||||
# PROFILE IMAGE CONFIG
|
||||
PROFILE_IMAGE_BACKEND = ENV_TOKENS.get('PROFILE_IMAGE_BACKEND', PROFILE_IMAGE_BACKEND)
|
||||
PROFILE_IMAGE_DEFAULT_FILENAME = ENV_TOKENS.get('PROFILE_IMAGE_DEFAULT_FILENAME', PROFILE_IMAGE_DEFAULT_FILENAME)
|
||||
PROFILE_IMAGE_SECRET_KEY = AUTH_TOKENS.get('PROFILE_IMAGE_SECRET_KEY', PROFILE_IMAGE_SECRET_KEY)
|
||||
PROFILE_IMAGE_MAX_BYTES = ENV_TOKENS.get('PROFILE_IMAGE_MAX_BYTES', PROFILE_IMAGE_MAX_BYTES)
|
||||
PROFILE_IMAGE_MIN_BYTES = ENV_TOKENS.get('PROFILE_IMAGE_MIN_BYTES', PROFILE_IMAGE_MIN_BYTES)
|
||||
if FEATURES['IS_EDX_DOMAIN']:
|
||||
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/edx-theme/default-profile'
|
||||
else:
|
||||
PROFILE_IMAGE_DEFAULT_FILENAME = ENV_TOKENS.get('PROFILE_IMAGE_DEFAULT_FILENAME', PROFILE_IMAGE_DEFAULT_FILENAME)
|
||||
|
||||
@@ -46,6 +46,13 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
]
|
||||
};
|
||||
|
||||
var createAccountSettingsPage = function() {
|
||||
var context = AccountSettingsPage(
|
||||
FIELDS_DATA, AUTH_DATA, Helpers.USER_ACCOUNTS_API_URL, Helpers.USER_PREFERENCES_API_URL, 'edX'
|
||||
);
|
||||
return context.accountSettingsView;
|
||||
};
|
||||
|
||||
var requests;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -61,10 +68,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
|
||||
requests = AjaxHelpers.requests(this);
|
||||
|
||||
var context = AccountSettingsPage(
|
||||
FIELDS_DATA, AUTH_DATA, Helpers.USER_ACCOUNTS_API_URL, Helpers.USER_PREFERENCES_API_URL
|
||||
);
|
||||
var accountSettingsView = context.accountSettingsView;
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
@@ -85,10 +89,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
|
||||
requests = AjaxHelpers.requests(this);
|
||||
|
||||
var context = AccountSettingsPage(
|
||||
FIELDS_DATA, AUTH_DATA, Helpers.USER_ACCOUNTS_API_URL, Helpers.USER_PREFERENCES_API_URL
|
||||
);
|
||||
var accountSettingsView = context.accountSettingsView;
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
@@ -117,10 +118,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
|
||||
requests = AjaxHelpers.requests(this);
|
||||
|
||||
var context = AccountSettingsPage(
|
||||
FIELDS_DATA, AUTH_DATA, Helpers.USER_ACCOUNTS_API_URL, Helpers.USER_PREFERENCES_API_URL
|
||||
);
|
||||
var accountSettingsView = context.accountSettingsView;
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
@@ -138,10 +136,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
|
||||
requests = AjaxHelpers.requests(this);
|
||||
|
||||
var context = AccountSettingsPage(
|
||||
FIELDS_DATA, AUTH_DATA, Helpers.USER_ACCOUNTS_API_URL, Helpers.USER_PREFERENCES_API_URL
|
||||
);
|
||||
var accountSettingsView = context.accountSettingsView;
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.createAccountSettingsData());
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.createUserPreferencesData());
|
||||
|
||||
@@ -82,7 +82,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
AjaxHelpers.respondWithError(requests, 500);
|
||||
FieldViewsSpecHelpers.expectMessageContains(
|
||||
view,
|
||||
"You must sign out of edX and sign back in before your language changes take effect."
|
||||
"You must sign out and sign back in before your language changes take effect."
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
|
||||
'profile_image_min_bytes': Helpers.IMAGE_MIN_BYTES,
|
||||
'profile_image_upload_url': Helpers.IMAGE_UPLOAD_API_URL,
|
||||
'profile_image_remove_url': Helpers.IMAGE_REMOVE_API_URL,
|
||||
'default_visibility': 'all_users'
|
||||
'default_visibility': 'all_users',
|
||||
'platform_name': 'edX'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
], function (gettext, $, _, Backbone, Logger, FieldViews, UserAccountModel, UserPreferencesModel,
|
||||
AccountSettingsFieldViews, AccountSettingsView) {
|
||||
|
||||
return function (fieldsData, authData, userAccountsApiUrl, userPreferencesApiUrl, accountUserId) {
|
||||
return function (fieldsData, authData, userAccountsApiUrl, userPreferencesApiUrl, accountUserId, platformName) {
|
||||
|
||||
var accountSettingsElement = $('.wrapper-account-settings');
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
model: userAccountModel,
|
||||
title: gettext('Username'),
|
||||
valueAttribute: 'username',
|
||||
helpMessage: gettext('The name that identifies you on the edX site. You cannot change your username.')
|
||||
helpMessage: interpolate_text(
|
||||
gettext('The name that identifies you throughout {platform_name}. You cannot change your username.'), {platform_name: platformName}
|
||||
)
|
||||
})
|
||||
},
|
||||
{
|
||||
@@ -37,7 +39,7 @@
|
||||
model: userAccountModel,
|
||||
title: gettext('Full Name'),
|
||||
valueAttribute: 'name',
|
||||
helpMessage: gettext('The name that appears on your edX certificates. Other learners never see your full name.')
|
||||
helpMessage: gettext('The name that appears on your certificates. Other learners never see your full name.')
|
||||
})
|
||||
},
|
||||
{
|
||||
@@ -45,7 +47,9 @@
|
||||
model: userAccountModel,
|
||||
title: gettext('Email Address'),
|
||||
valueAttribute: 'email',
|
||||
helpMessage: gettext('The email address you use to sign in to edX. Communications from edX and your courses are sent to this address.')
|
||||
helpMessage: interpolate_text(
|
||||
gettext('The email address you use to sign in. Communications from {platform_name} and your courses are sent to this address.'), {platform_name: platformName}
|
||||
)
|
||||
})
|
||||
},
|
||||
{
|
||||
@@ -67,8 +71,9 @@
|
||||
valueAttribute: 'pref-lang',
|
||||
required: true,
|
||||
refreshPageOnSave: true,
|
||||
helpMessage:
|
||||
gettext('The language used for the edX site. The site is currently available in a limited number of languages.'),
|
||||
helpMessage: interpolate_text(
|
||||
gettext('The language used throughout this site. This site is currently available in a limited number of languages.'), {platform_name: platformName}
|
||||
),
|
||||
options: fieldsData.language.options
|
||||
})
|
||||
},
|
||||
|
||||
@@ -38,10 +38,7 @@
|
||||
error: function () {
|
||||
view.showNotificationMessage(
|
||||
view.indicators.error +
|
||||
gettext(
|
||||
'You must sign out of edX and sign back in before your language ' +
|
||||
'changes take effect.'
|
||||
)
|
||||
gettext('You must sign out and sign back in before your language changes take effect.')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
required: true,
|
||||
editable: 'always',
|
||||
showMessages: false,
|
||||
title: gettext('edX learners can see my:'),
|
||||
title: interpolate_text(
|
||||
gettext('{platform_name} learners can see my:'), {platform_name: options.platform_name}
|
||||
),
|
||||
valueAttribute: "account_privacy",
|
||||
options: [
|
||||
['private', gettext('Limited Profile')],
|
||||
@@ -101,7 +103,7 @@
|
||||
editable: editable,
|
||||
showMessages: false,
|
||||
title: gettext('About me'),
|
||||
placeholderValue: gettext("Tell other edX learners a little about yourself: where you live, what your interests are, why you're taking courses on edX, or what you hope to learn."),
|
||||
placeholderValue: gettext("Tell other learners a little about yourself: where you live, what your interests are, why you're taking courses, or what you hope to learn."),
|
||||
valueAttribute: "bio",
|
||||
helpMessage: ''
|
||||
})
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<%! import json %>
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
<%! from django.conf import settings %>
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
<%! from microsite_configuration import microsite %>
|
||||
|
||||
<!--<%namespace name='static' file='/static_content.html'/>-->
|
||||
|
||||
@@ -40,9 +42,11 @@
|
||||
|
||||
var fieldsData = ${ json.dumps(fields) };
|
||||
var authData = ${ json.dumps(auth) };
|
||||
var platformName = ${ json.dumps(microsite.get_value('platform_name', settings.PLATFORM_NAME))};
|
||||
|
||||
setupAccountSettingsSection(
|
||||
fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id}
|
||||
fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id},
|
||||
platformName
|
||||
);
|
||||
});
|
||||
}).call(this, require || RequireJS.require);
|
||||
|
||||
@@ -8,6 +8,8 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.files.storage import get_storage_class
|
||||
from staticfiles.storage import staticfiles_storage
|
||||
|
||||
from microsite_configuration import microsite
|
||||
|
||||
from student.models import UserProfile
|
||||
from ..errors import UserNotFound
|
||||
|
||||
@@ -108,7 +110,7 @@ def _get_default_profile_image_urls():
|
||||
TODO The result of this function should be memoized, but not in tests.
|
||||
"""
|
||||
return _get_profile_image_urls(
|
||||
settings.PROFILE_IMAGE_DEFAULT_FILENAME,
|
||||
microsite.get_value('PROFILE_IMAGE_DEFAULT_FILENAME', settings.PROFILE_IMAGE_DEFAULT_FILENAME),
|
||||
staticfiles_storage,
|
||||
file_extension=settings.PROFILE_IMAGE_DEFAULT_FILE_EXTENSION,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user