Skip to content
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
6 changes: 3 additions & 3 deletions lms/djangoapps/student_account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def account_settings_context(request):
user = request.user

country_options = [
(country_code, unicode(country_name))
(country_code, _(country_name)) # pylint: disable=translation-of-non-string
for country_code, country_name in sorted(
countries.countries, key=lambda(__, name): unicode(name)
)
Expand All @@ -354,11 +354,11 @@ def account_settings_context(request):
'country': {
'options': country_options,
}, 'gender': {
'options': UserProfile.GENDER_CHOICES,
'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES], # pylint: disable=translation-of-non-string
}, 'language': {
'options': released_languages(),
}, 'level_of_education': {
'options': UserProfile.LEVEL_OF_EDUCATION_CHOICES,
'options': [(choice[0], _(choice[1])) for choice in UserProfile.LEVEL_OF_EDUCATION_CHOICES], # pylint: disable=translation-of-non-string
}, 'password': {
'url': reverse('password_reset'),
}, 'year_of_birth': {
Expand Down
7 changes: 4 additions & 3 deletions lms/djangoapps/student_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from edxmako.shortcuts import render_to_response
from student.models import User

from django.utils.translation import ugettext as _


@login_required
@require_http_methods(['GET'])
Expand Down Expand Up @@ -55,10 +57,9 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff)
ObjectDoesNotExist: the specified profile_username does not exist.
"""
profile_user = User.objects.get(username=profile_username)
language_options = [language for language in settings.ALL_LANGUAGES]

country_options = [
(country_code, unicode(country_name))
(country_code, _(country_name)) # pylint: disable=translation-of-non-string
for country_code, country_name in sorted(
countries.countries, key=lambda(__, name): unicode(name)
)
Expand All @@ -78,7 +79,7 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff)
'has_preferences_access': (logged_in_username == profile_username or user_is_staff),
'own_profile': (logged_in_username == profile_username),
'country_options': country_options,
'language_options': language_options,
'language_options': settings.ALL_LANGUAGES,
}
}

Expand Down
25 changes: 7 additions & 18 deletions lms/static/js/student_account/views/account_settings_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,15 @@
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 edX certificates. Other learners never see your full name.')
})
},
{
view: new AccountSettingsFieldViews.EmailFieldView({
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: gettext('The email address you use to sign in to edX. Communications from edX and your courses are sent to this address.')
})
},
{
Expand All @@ -62,24 +56,19 @@
valueAttribute: 'password',
emailAttribute: 'email',
linkTitle: gettext('Reset Password'),
linkHref: fieldsData['password']['url'],
helpMessage: gettext(
'When you click "Reset Password", a message will be sent to your email address. ' +
'Click the link in the message to reset your password.'
)
linkHref: fieldsData.password.url,
helpMessage: gettext('When you click "Reset Password", a message will be sent to your email address. Click the link in the message to reset your password.')
})
},
{
view: new AccountSettingsFieldViews.LanguagePreferenceFieldView({
model: userPreferencesModel,
title: 'Language',
title: gettext('Language'),
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:
gettext('The language used for the edX site. The site is currently available in a limited number of languages.'),
options: fieldsData.language.options
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,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 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."),
valueAttribute: "bio",
helpMessage: ''
})
Expand Down
14 changes: 5 additions & 9 deletions lms/static/js/student_profile/views/learner_profile_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@
var accountSettingsLink = '<a href="' + this.options.accountSettingsPageUrl + '">' + gettext('Account Settings page.') + '</a>';
if (this.profileIsPrivate) {
this._super(interpolate_text(
gettext(
"You must specify your birth year before you can share your full profile. To specify " +
"your birth year, go to the {account_settings_page_link}"
),
gettext("You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}"),
{'account_settings_page_link': accountSettingsLink}
));
} else if (this.requiresParentalConsent) {
this._super(interpolate_text(
gettext(
'You must be over 13 to share a full profile. If you are over 13, make sure that you ' +
'have specified a birth year on the {account_settings_page_link}'
),
gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'),
{'account_settings_page_link': accountSettingsLink}
));
}
Expand All @@ -55,7 +49,9 @@
},

imageAltText: function () {
return interpolate_text(gettext("Profile image for {username}"), {username: this.model.get('username')});
return interpolate_text(
gettext("Profile image for {username}"), {username: this.model.get('username')}
);
},

imageChangeSucceeded: function (e, data) {
Expand Down
22 changes: 9 additions & 13 deletions lms/static/js/views/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
tagName: 'div',

indicators: {
'canEdit': '<i class="icon fa fa-pencil message-can-edit" aria-hidden="true"></i><span class="sr">gettext("Editable")</span>',
'error': '<i class="fa fa-exclamation-triangle message-error" aria-hidden="true"></i><span class="sr">gettext("Error")</span>',
'validationError': '<i class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></i><span class="sr">gettext("Validation Error")</span>',
'inProgress': '<i class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i><span class="sr">gettext("In Progress")</span>',
'success': '<i class="fa fa-check message-success" aria-hidden="true"></i><span class="sr">gettext("Success")</span>',
'plus': '<i class="fa fa-plus placeholder" aria-hidden="true"></i><span class="sr">gettext("Placeholder")</span>'
'canEdit': '<i class="icon fa fa-pencil message-can-edit" aria-hidden="true"></i><span class="sr">' + gettext("Editable") + '</span>',
'error': '<i class="fa fa-exclamation-triangle message-error" aria-hidden="true"></i><span class="sr">' + gettext("Error") + '</span>',
'validationError': '<i class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></i><span class="sr">' + gettext("Validation Error") + '</span>',
'inProgress': '<i class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i><span class="sr">' + gettext("In Progress") + '</span>',
'success': '<i class="fa fa-check message-success" aria-hidden="true"></i><span class="sr">' + gettext("Success") + '</span>',
'plus': '<i class="fa fa-plus placeholder" aria-hidden="true"></i><span class="sr">' + gettext("Placeholder")+ '</span>'
},

messages: {
Expand Down Expand Up @@ -711,18 +711,14 @@
onBeforeUnload: function () {
var status = this.getCurrentStatus();
if (status === 'uploading') {
return gettext(
"Upload is in progress. To avoid errors, stay on this page until the process is complete."
);
return gettext("Upload is in progress. To avoid errors, stay on this page until the process is complete.");
} else if (status === 'removing') {
return gettext(
"Removal is in progress. To avoid errors, stay on this page until the process is complete."
);
return gettext("Removal is in progress. To avoid errors, stay on this page until the process is complete.");
}
},

bytesToHumanReadable: function (size) {
var units = ['bytes', 'KB', 'MB'];
var units = [gettext('bytes'), gettext('KB'), gettext('MB')];
var i = 0;
while(size >= 1024) {
size /= 1024;
Expand Down
6 changes: 3 additions & 3 deletions lms/templates/fields/field_dropdown.underscore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if (title) { %>
<label class="u-field-title" for="u-field-select-<%- id %>">
<%- gettext(title) %>
<%- title %>
</label>
<% } %>

Expand All @@ -20,7 +20,7 @@
</select>
<% } else { %>
<a href="#" class="u-field-value-display">
<span class="sr"><%- gettext(screenReaderTitle) %></span>
<span class="sr"><%- screenReaderTitle %></span>
<span class="u-field-value-readonly"></span>
<span class="sr"><%- gettext('Click to edit') %></span>
</a>
Expand All @@ -29,5 +29,5 @@

<span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"><%- gettext(message) %></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"><%- message %></span>
</span>
2 changes: 1 addition & 1 deletion lms/templates/fields/field_image.underscore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="image-wrapper">
<img class="image-frame" src="<%- gettext(imageUrl) %>" alt="<%=imageAltText%>"/>
<img class="image-frame" src="<%- imageUrl %>" alt="<%=imageAltText%>"/>
<div class="u-field-actions">
<label class="u-field-upload-button">
<span class="upload-button-icon" aria-hidden="true"><%= uploadButtonIcon %></span>
Expand Down
8 changes: 4 additions & 4 deletions lms/templates/fields/field_link.underscore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<span class="u-field-title" for="u-field-link-<%- id %>">
<%- gettext(title) %>
<%- title %>
</span>
<span class="u-field-value">
<a id="u-field-link-<%- id %>" href="<%- linkHref %>" aria-describedby="u-field-message-help-<%- id %>">
<span class="sr"><%- gettext(screenReaderTitle) %></span>
<span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- gettext(linkTitle) %></span>
<span class="sr"><%- screenReaderTitle %></span>
<span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- linkTitle %></span>
</a>
</span>
<span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"><%- gettext(message) %></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"><%- message %></span>
</span>
4 changes: 2 additions & 2 deletions lms/templates/fields/field_readonly.underscore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<%- gettext(title) %>
</label>
<span class="u-field-value">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-<%- id %>" type="text" name="input" readonly=true value="<%- gettext(value) %>">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-<%- id %>" type="text" name="input" readonly=true value="<%- value %>">
</span>
<span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"> <%- gettext(message) %></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"> <%- message %></span>
</span>
4 changes: 2 additions & 2 deletions lms/templates/fields/field_text.underscore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<%- gettext(title) %>
</label>
<span class="u-field-value">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-help-<%- id %>" type="text" name="input" value="<%- gettext(value) %>">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-help-<%- id %>" type="text" name="input" value="<%- value %>">
</span>
<span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- gettext(message) %></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- message %></span>
</span>
6 changes: 3 additions & 3 deletions lms/templates/fields/field_textarea.underscore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<label class="u-field-title" for="u-field-textarea-<%- id %>" id="u-field-title-<%- id %>" aria-describedby="u-field-message-help-<%- id %>"></label>
<span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- gettext(message) %></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- message %></span>
</span>
</div>

<div class="u-field-value" id="u-field-value-<%- id %>" aria-labelledby="u-field-title-<%- id %>"><%
if (mode === 'edit') {
%><textarea id="u-field-textarea-<%- id %>" rows="4" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></textarea><%
} else {
%><a href="#" class="u-field-value-display"><span class="sr"><%- gettext(screenReaderTitle) %></span><span class="u-field-value-readonly" aria-hidden="false" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></span><span class="sr"><%- gettext('Click to edit') %></span></a><%
%><a href="#" class="u-field-value-display"><span class="sr"><%- screenReaderTitle %></span><span class="u-field-value-readonly" aria-hidden="false" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></span><span class="sr"><%- gettext('Click to edit') %></span></a><%
}
%><span class="sr" id="u-field-placeholder-value-<%- id %>"><%- gettext(placeholderValue) %></span>
%><span class="sr" id="u-field-placeholder-value-<%- id %>"><%- placeholderValue %></span>
</div>
</div>
4 changes: 2 additions & 2 deletions lms/templates/student_profile/learner_profile.underscore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<div class="profile-section-two-fields">
<% if (!showFullProfile) { %>
<% if(ownProfile) { %>
<span class="profile-private--message"><%- gettext("You are currently sharing a limited profile.") %></span>
<span class="profile-private--message" tabindex="0"><%- gettext("You are currently sharing a limited profile.") %></span>
<% } else { %>
<span class="profile-private--message"><%- gettext("This edX learner is currently sharing a limited profile.") %></span>
<span class="profile-private--message" tabindex="0"><%- gettext("This edX learner is currently sharing a limited profile.") %></span>
<% } %>
<% } %>
</div>
Expand Down