From 9e06290b95f0207e26cd4424bafd41c6c125c87d Mon Sep 17 00:00:00 2001 From: muzaffaryousaf Date: Mon, 27 Apr 2015 15:12:22 +0500 Subject: [PATCH 1/4] Fixing the micro-sites naming issues for account settings page. TNL-2071 --- .../views/account_settings_factory.js | 20 +++++++++++++------ .../student_account/account_settings.html | 6 +++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lms/static/js/student_account/views/account_settings_factory.js b/lms/static/js/student_account/views/account_settings_factory.js index af46599688..ac2fd1cd6b 100644 --- a/lms/static/js/student_account/views/account_settings_factory.js +++ b/lms/static/js/student_account/views/account_settings_factory.js @@ -10,8 +10,9 @@ ], 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 interpolate_text = window.interpolate_text; var accountSettingsElement = $('.wrapper-account-settings'); var userAccountModel = new UserAccountModel(); @@ -29,7 +30,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 on the {platformName} site. You cannot change your username.'), {platformName: platformName} + ) }) }, { @@ -37,7 +40,9 @@ 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: interpolate_text( + gettext('The name that appears on your {platformName} certificates. Other learners never see your full name.'), {platformName: platformName} + ) }) }, { @@ -45,7 +50,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 to {platformName}. Communications from {platformName} and your courses are sent to this address.'), {platformName: platformName} + ) }) }, { @@ -67,8 +74,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 for the {platformName} site. The site is currently available in a limited number of languages.'), {platformName: platformName} + ), options: fieldsData.language.options }) }, diff --git a/lms/templates/student_account/account_settings.html b/lms/templates/student_account/account_settings.html index d05a55ca69..7b3fed68bb 100644 --- a/lms/templates/student_account/account_settings.html +++ b/lms/templates/student_account/account_settings.html @@ -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 %> @@ -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); From d0db373456bd8e432741751943e5bafc9061f695 Mon Sep 17 00:00:00 2001 From: muzaffaryousaf Date: Mon, 27 Apr 2015 16:10:18 +0500 Subject: [PATCH 2/4] Fixing the micro-sites naming issues for profile page. TNL-2072 --- lms/djangoapps/student_profile/views.py | 3 +++ .../account_settings_factory_spec.js | 27 ++++++++----------- .../account_settings_fields_spec.js | 2 +- .../learner_profile_factory_spec.js | 3 ++- .../views/account_settings_factory.js | 9 +++---- .../views/account_settings_fields.js | 5 +--- .../views/learner_profile_factory.js | 8 ++++-- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/lms/djangoapps/student_profile/views.py b/lms/djangoapps/student_profile/views.py index 7ac0b09491..1a38b06d25 100644 --- a/lms/djangoapps/student_profile/views.py +++ b/lms/djangoapps/student_profile/views.py @@ -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), } } diff --git a/lms/static/js/spec/student_account/account_settings_factory_spec.js b/lms/static/js/spec/student_account/account_settings_factory_spec.js index 7685e8bed9..becad825f8 100644 --- a/lms/static/js/spec/student_account/account_settings_factory_spec.js +++ b/lms/static/js/spec/student_account/account_settings_factory_spec.js @@ -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()); diff --git a/lms/static/js/spec/student_account/account_settings_fields_spec.js b/lms/static/js/spec/student_account/account_settings_fields_spec.js index 1970e9ebcd..8ce84c6ae1 100644 --- a/lms/static/js/spec/student_account/account_settings_fields_spec.js +++ b/lms/static/js/spec/student_account/account_settings_fields_spec.js @@ -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." ); }); diff --git a/lms/static/js/spec/student_profile/learner_profile_factory_spec.js b/lms/static/js/spec/student_profile/learner_profile_factory_spec.js index 7d3bd8e1bc..3aa2cc2458 100644 --- a/lms/static/js/spec/student_profile/learner_profile_factory_spec.js +++ b/lms/static/js/spec/student_profile/learner_profile_factory_spec.js @@ -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' }); }; diff --git a/lms/static/js/student_account/views/account_settings_factory.js b/lms/static/js/student_account/views/account_settings_factory.js index ac2fd1cd6b..3194680dc8 100644 --- a/lms/static/js/student_account/views/account_settings_factory.js +++ b/lms/static/js/student_account/views/account_settings_factory.js @@ -12,7 +12,6 @@ return function (fieldsData, authData, userAccountsApiUrl, userPreferencesApiUrl, accountUserId, platformName) { - var interpolate_text = window.interpolate_text; var accountSettingsElement = $('.wrapper-account-settings'); var userAccountModel = new UserAccountModel(); @@ -31,7 +30,7 @@ title: gettext('Username'), valueAttribute: 'username', helpMessage: interpolate_text( - gettext('The name that identifies you on the {platformName} site. You cannot change your username.'), {platformName: platformName} + gettext('The name that identifies you on the {platform_name} site. You cannot change your username.'), {platform_name: platformName} ) }) }, @@ -41,7 +40,7 @@ title: gettext('Full Name'), valueAttribute: 'name', helpMessage: interpolate_text( - gettext('The name that appears on your {platformName} certificates. Other learners never see your full name.'), {platformName: platformName} + gettext('The name that appears on your {platform_name} certificates. Other learners never see your full name.'), {platform_name: platformName} ) }) }, @@ -51,7 +50,7 @@ title: gettext('Email Address'), valueAttribute: 'email', helpMessage: interpolate_text( - gettext('The email address you use to sign in to {platformName}. Communications from {platformName} and your courses are sent to this address.'), {platformName: platformName} + gettext('The email address you use to sign in to {platform_name}. Communications from {platform_name} and your courses are sent to this address.'), {platform_name: platformName} ) }) }, @@ -75,7 +74,7 @@ required: true, refreshPageOnSave: true, helpMessage: interpolate_text( - gettext('The language used for the {platformName} site. The site is currently available in a limited number of languages.'), {platformName: platformName} + gettext('The language used for the {platform_name} site. The site is currently available in a limited number of languages.'), {platform_name: platformName} ), options: fieldsData.language.options }) diff --git a/lms/static/js/student_account/views/account_settings_fields.js b/lms/static/js/student_account/views/account_settings_fields.js index ca3fe3f492..45bea90f8d 100644 --- a/lms/static/js/student_account/views/account_settings_fields.js +++ b/lms/static/js/student_account/views/account_settings_fields.js @@ -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.') ); } }); diff --git a/lms/static/js/student_profile/views/learner_profile_factory.js b/lms/static/js/student_profile/views/learner_profile_factory.js index dfe65a1dd7..febc935a61 100644 --- a/lms/static/js/student_profile/views/learner_profile_factory.js +++ b/lms/static/js/student_profile/views/learner_profile_factory.js @@ -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,9 @@ 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: interpolate_text( + gettext("Tell other {platform_name} learners a little about yourself: where you live, what your interests are, why you're taking courses on {platform_name}, or what you hope to learn."), {platform_name: options.platform_name} + ), valueAttribute: "bio", helpMessage: '' }) From f439a09e7181a56370c3105904ff9c5f11fc29c5 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 27 Apr 2015 11:12:28 -0400 Subject: [PATCH 3/4] Obey microsite configuration for default profile image TNL-2073 --- lms/envs/aws.py | 3 ++- openedx/core/djangoapps/user_api/accounts/image_helpers.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 9d21ce3760..7ec48ef4f0 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -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) diff --git a/openedx/core/djangoapps/user_api/accounts/image_helpers.py b/openedx/core/djangoapps/user_api/accounts/image_helpers.py index 8c38dd4f3f..48dde39941 100644 --- a/openedx/core/djangoapps/user_api/accounts/image_helpers.py +++ b/openedx/core/djangoapps/user_api/accounts/image_helpers.py @@ -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, ) From 001da52af6d2b3fee5ae45fb4bd19f7fea28c507 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 27 Apr 2015 14:58:30 -0400 Subject: [PATCH 4/4] Address Sylvia's doc feedback --- .../test/acceptance/tests/lms/test_learner_profile.py | 4 ++-- .../student_account/views/account_settings_factory.js | 10 ++++------ .../student_profile/views/learner_profile_factory.js | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 226ddfe87c..73ae7e3f42 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -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() diff --git a/lms/static/js/student_account/views/account_settings_factory.js b/lms/static/js/student_account/views/account_settings_factory.js index 3194680dc8..07daa25174 100644 --- a/lms/static/js/student_account/views/account_settings_factory.js +++ b/lms/static/js/student_account/views/account_settings_factory.js @@ -30,7 +30,7 @@ title: gettext('Username'), valueAttribute: 'username', helpMessage: interpolate_text( - gettext('The name that identifies you on the {platform_name} site. You cannot change your username.'), {platform_name: platformName} + gettext('The name that identifies you throughout {platform_name}. You cannot change your username.'), {platform_name: platformName} ) }) }, @@ -39,9 +39,7 @@ model: userAccountModel, title: gettext('Full Name'), valueAttribute: 'name', - helpMessage: interpolate_text( - gettext('The name that appears on your {platform_name} certificates. Other learners never see your full name.'), {platform_name: platformName} - ) + helpMessage: gettext('The name that appears on your certificates. Other learners never see your full name.') }) }, { @@ -50,7 +48,7 @@ title: gettext('Email Address'), valueAttribute: 'email', helpMessage: interpolate_text( - gettext('The email address you use to sign in to {platform_name}. Communications from {platform_name} and your courses are sent to this address.'), {platform_name: platformName} + gettext('The email address you use to sign in. Communications from {platform_name} and your courses are sent to this address.'), {platform_name: platformName} ) }) }, @@ -74,7 +72,7 @@ required: true, refreshPageOnSave: true, helpMessage: interpolate_text( - gettext('The language used for the {platform_name} site. The site is currently available in a limited number of languages.'), {platform_name: platformName} + 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 }) diff --git a/lms/static/js/student_profile/views/learner_profile_factory.js b/lms/static/js/student_profile/views/learner_profile_factory.js index febc935a61..a66dc3f45e 100644 --- a/lms/static/js/student_profile/views/learner_profile_factory.js +++ b/lms/static/js/student_profile/views/learner_profile_factory.js @@ -103,9 +103,7 @@ editable: editable, showMessages: false, title: gettext('About me'), - placeholderValue: interpolate_text( - gettext("Tell other {platform_name} learners a little about yourself: where you live, what your interests are, why you're taking courses on {platform_name}, or what you hope to learn."), {platform_name: options.platform_name} - ), + 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: '' })