Commit 3110cf6b by muzaffaryousaf Committed by Andy Armstrong

Remove account settings display and editing from dashboard sidebar.

TNL-1516
parent 429984ef
...@@ -620,40 +620,11 @@ def dashboard(request): ...@@ -620,40 +620,11 @@ def dashboard(request):
enrolled_courses_either_paid = frozenset(course.id for course, _enrollment in course_enrollment_pairs enrolled_courses_either_paid = frozenset(course.id for course, _enrollment in course_enrollment_pairs
if _enrollment.is_paid_course()) if _enrollment.is_paid_course())
# get info w.r.t ExternalAuthMap
external_auth_map = None
try:
external_auth_map = ExternalAuthMap.objects.get(user=user)
except ExternalAuthMap.DoesNotExist:
pass
# If there are *any* denied reverifications that have not been toggled off, # If there are *any* denied reverifications that have not been toggled off,
# we'll display the banner # we'll display the banner
denied_banner = any(item.display for item in reverifications["denied"]) denied_banner = any(item.display for item in reverifications["denied"])
language_options = DarkLangConfig.current().released_languages_list
# add in the default language if it's not in the list of released languages
if settings.LANGUAGE_CODE not in language_options:
language_options.append(settings.LANGUAGE_CODE)
# Re-alphabetize language options
language_options.sort()
# try to get the preferred language for the user
preferred_language_code = preferences_api.get_user_preference(request.user, LANGUAGE_KEY)
# try and get the current language of the user
current_language_code = get_language()
if preferred_language_code and preferred_language_code in settings.LANGUAGE_DICT:
# if the user has a preference, get the name from the code
current_language = settings.LANGUAGE_DICT[preferred_language_code]
elif current_language_code in settings.LANGUAGE_DICT:
# if the user's browser is showing a particular language,
# use that as the current language
current_language = settings.LANGUAGE_DICT[current_language_code]
else:
# otherwise, use the default language
current_language = settings.LANGUAGE_DICT[settings.LANGUAGE_CODE]
# Populate the Order History for the side-bar. # Populate the Order History for the side-bar.
order_history_list = order_history(user, course_org_filter=course_org_filter, org_filter_out_set=org_filter_out_set) order_history_list = order_history(user, course_org_filter=course_org_filter, org_filter_out_set=org_filter_out_set)
...@@ -678,7 +649,6 @@ def dashboard(request): ...@@ -678,7 +649,6 @@ def dashboard(request):
'course_enrollment_pairs': course_enrollment_pairs, 'course_enrollment_pairs': course_enrollment_pairs,
'course_optouts': course_optouts, 'course_optouts': course_optouts,
'message': message, 'message': message,
'external_auth_map': external_auth_map,
'staff_access': staff_access, 'staff_access': staff_access,
'errored_courses': errored_courses, 'errored_courses': errored_courses,
'show_courseware_links_for': show_courseware_links_for, 'show_courseware_links_for': show_courseware_links_for,
...@@ -693,11 +663,7 @@ def dashboard(request): ...@@ -693,11 +663,7 @@ def dashboard(request):
'block_courses': block_courses, 'block_courses': block_courses,
'denied_banner': denied_banner, 'denied_banner': denied_banner,
'billing_email': settings.PAYMENT_SUPPORT_EMAIL, 'billing_email': settings.PAYMENT_SUPPORT_EMAIL,
'language_options': language_options,
'current_language': current_language,
'current_language_code': current_language_code,
'user': user, 'user': user,
'duplicate_provider': None,
'logout_url': reverse(logout_user), 'logout_url': reverse(logout_user),
'platform_name': platform_name, 'platform_name': platform_name,
'enrolled_courses_either_paid': enrolled_courses_either_paid, 'enrolled_courses_either_paid': enrolled_courses_either_paid,
...@@ -707,10 +673,6 @@ def dashboard(request): ...@@ -707,10 +673,6 @@ def dashboard(request):
'ccx_membership_triplets': ccx_membership_triplets, 'ccx_membership_triplets': ccx_membership_triplets,
} }
if third_party_auth.is_enabled():
context['duplicate_provider'] = pipeline.get_duplicate_provider(messages.get_messages(request))
context['provider_user_states'] = pipeline.get_provider_user_states(user)
return render_to_response('dashboard.html', context) return render_to_response('dashboard.html', context)
......
...@@ -50,19 +50,18 @@ class DashboardPage(PageObject): ...@@ -50,19 +50,18 @@ class DashboardPage(PageObject):
return self.q(css='h3.course-title > a').map(_get_course_name).results return self.q(css='h3.course-title > a').map(_get_course_name).results
@property @property
def full_name(self): def sidebar_menu_title(self):
"""Return the displayed value for the user's full name""" """
return self.q(css='li.info--username .data').text[0] Return the title value for sidebar menu.
"""
@property return self.q(css='.user-info span.title').text[0]
def email(self):
"""Return the displayed value for the user's email address"""
return self.q(css='li.info--email .data').text[0]
@property @property
def username(self): def sidebar_menu_description(self):
"""Return the displayed value for the user's username""" """
return self.q(css='.username-label').text[0] Return the description text for sidebar menu.
"""
return self.q(css='.user-info span.copy').text[0]
def get_enrollment_mode(self, course_name): def get_enrollment_mode(self, course_name):
"""Get the enrollment mode for a given course on the dashboard. """Get the enrollment mode for a given course on the dashboard.
...@@ -149,27 +148,6 @@ class DashboardPage(PageObject): ...@@ -149,27 +148,6 @@ class DashboardPage(PageObject):
else: else:
return None return None
def change_language(self, code):
"""
Change the language on the dashboard to the language corresponding with `code`.
"""
self.q(css=".edit-language").first.click()
self.q(css='select[name="language"] option[value="{}"]'.format(code)).first.click()
self.q(css="#submit-lang").first.click()
# Clicking the submit-lang button does a jquery ajax post, so make sure that
# has completed before continuing on.
self.wait_for_ajax()
self._changed_lang_promise(code).fulfill()
def _changed_lang_promise(self, code):
def _check_func():
language_is_selected = self.q(css='select[name="language"] option[value="{}"]'.format(code)).selected
modal_is_visible = self.q(css='section#change_language.modal').visible
return (language_is_selected and not modal_is_visible)
return EmptyPromise(_check_func, "language changed and modal hidden")
def pre_requisite_message_displayed(self): def pre_requisite_message_displayed(self):
""" """
Verify if pre-requisite course messages are being displayed. Verify if pre-requisite course messages are being displayed.
......
...@@ -173,9 +173,11 @@ class RegisterFromCombinedPageTest(UniqueCourseTest): ...@@ -173,9 +173,11 @@ class RegisterFromCombinedPageTest(UniqueCourseTest):
course_names = self.dashboard_page.wait_for_page().available_courses course_names = self.dashboard_page.wait_for_page().available_courses
self.assertIn(self.course_info["display_name"], course_names) self.assertIn(self.course_info["display_name"], course_names)
self.assertEqual("Test User", self.dashboard_page.full_name) self.assertEqual("want to change your account settings?", self.dashboard_page.sidebar_menu_title.lower())
self.assertEqual(email, self.dashboard_page.email) self.assertEqual(
self.assertEqual(username, self.dashboard_page.username) "click the arrow next to your username above.",
self.dashboard_page.sidebar_menu_description.lower()
)
def test_register_failure(self): def test_register_failure(self):
# Navigate to the registration page # Navigate to the registration page
...@@ -369,61 +371,6 @@ class PayAndVerifyTest(EventsTestMixin, UniqueCourseTest): ...@@ -369,61 +371,6 @@ class PayAndVerifyTest(EventsTestMixin, UniqueCourseTest):
self.assertEqual(enrollment_mode, 'verified') self.assertEqual(enrollment_mode, 'verified')
class LanguageTest(WebAppTest):
"""
Tests that the change language functionality on the dashboard works
"""
def setUp(self):
"""
Initiailize dashboard page
"""
super(LanguageTest, self).setUp()
self.dashboard_page = DashboardPage(self.browser)
self.test_new_lang = 'eo'
# This string is unicode for "ÇÜRRÉNT ÇØÜRSÉS", which should appear in our Dummy Esperanto page
# We store the string this way because Selenium seems to try and read in strings from
# the HTML in this format. Ideally we could just store the raw ÇÜRRÉNT ÇØÜRSÉS string here
self.current_courses_text = u'\xc7\xdcRR\xc9NT \xc7\xd6\xdcRS\xc9S'
self.username = "test"
self.password = "testpass"
self.email = "test@example.com"
def test_change_lang(self):
AutoAuthPage(self.browser).visit()
self.dashboard_page.visit()
# Change language to Dummy Esperanto
self.dashboard_page.change_language(self.test_new_lang)
changed_text = self.dashboard_page.current_courses_text
# We should see the dummy-language text on the page
self.assertIn(self.current_courses_text, changed_text)
def test_language_persists(self):
auto_auth_page = AutoAuthPage(self.browser, username=self.username, password=self.password, email=self.email)
auto_auth_page.visit()
self.dashboard_page.visit()
# Change language to Dummy Esperanto
self.dashboard_page.change_language(self.test_new_lang)
# destroy session
self.browser.delete_all_cookies()
# log back in
auto_auth_page.visit()
self.dashboard_page.visit()
changed_text = self.dashboard_page.current_courses_text
# We should see the dummy-language text on the page
self.assertIn(self.current_courses_text, changed_text)
class CourseWikiTest(UniqueCourseTest): class CourseWikiTest(UniqueCourseTest):
""" """
Tests that verify the course wiki. Tests that verify the course wiki.
......
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
* Specifically: * Specifically:
* - dashboard * - dashboard
* - signInUser * - signInUser
* - passwordReset
* - changeEmail
* - changeEmailSettings * - changeEmailSettings
* - changeName
* - verifyToggleBannerFailedOff * - verifyToggleBannerFailedOff
*/ */
edx.dashboard.legacy.init = function(urls) { edx.dashboard.legacy.init = function(urls) {
...@@ -160,67 +157,6 @@ ...@@ -160,67 +157,6 @@
} }
}); });
$('#pwd_reset_button').click(function() {
$.post(
urls.passwordReset,
{"email" : $('#id_email').val()},
function() {
$("#password_reset_complete_link").click();
}
);
});
$("#submit-lang").click(function(event) {
event.preventDefault();
$.post('/lang_pref/setlang/',
{language: $('#settings-language-value').val()}
).done(function() {
// submit form as normal
$('.settings-language-form').submit();
});
});
$("#change_email_form").submit(function(){
var new_email = $('#new_email_field').val();
var new_password = $('#new_email_password').val();
$.post(
urls.changeEmail,
{"new_email" : new_email, "password" : new_password},
function(data) {
if (data.success) {
$("#change_email_title").html(gettext("Please verify your new email address"));
$("#change_email_form").html(
"<p>" +
gettext("You'll receive a confirmation in your inbox. Please follow the link in the email to confirm your email address change.") +
"</p>"
);
} else {
$("#change_email_error").html(data.error).stop().css("display", "block");
}
}
);
return false;
});
$("#change_name_form").submit(function(){
var new_name = $('#new_name_field').val();
var rationale = $('#name_rationale_field').val();
$.post(
urls.changeName,
{"new_name":new_name, "rationale":rationale},
function(data) {
if(data.success) {
location.reload();
} else {
$("#change_name_error").html(data.error).stop().css("display", "block");
}
}
);
return false;
});
$("#email_settings_form").submit(function(){ $("#email_settings_form").submit(function(){
$.ajax({ $.ajax({
type: "POST", type: "POST",
...@@ -240,24 +176,6 @@ ...@@ -240,24 +176,6 @@
return false; return false;
}); });
accessibleModal(
".edit-name",
"#apply_name_change .close-modal",
"#apply_name_change",
"#dashboard-main"
);
accessibleModal(
".edit-email",
"#change_email .close-modal",
"#change_email",
"#dashboard-main"
);
accessibleModal(
"#pwd_reset_button",
"#password_reset_complete .close-modal",
"#password_reset_complete",
"#dashboard-main"
);
$(".action-email-settings").each(function(index){ $(".action-email-settings").each(function(index){
$(this).attr("id", "email-settings-" + index); $(this).attr("id", "email-settings-" + index);
......
...@@ -16,33 +16,13 @@ ...@@ -16,33 +16,13 @@
padding: ($baseline*2) 0 0 0; padding: ($baseline*2) 0 0 0;
.profile-sidebar { .profile-sidebar {
background: transparent;
@include float(right); @include float(right);
@include margin-left(flex-gutter()); margin-top: ($baseline*2);
width: flex-grid(3); width: flex-grid(3);
background: transparent; box-shadow: 0 0 1px $shadow-l1;
border: 1px solid $border-color-2;
.profile { border-radius: 3px;
@include box-sizing(border-box);
border: 1px solid $border-color-2;
border-radius: ($baseline/4) ($baseline/4) 0 0;
width: flex-grid(12);
.username-header {
margin-bottom: 0;
}
.username-label {
@extend %t-title7;
@extend %t-ultrastrong;
@extend %cont-truncated;
text-align: center;
display: block;
margin: 0;
padding: ($baseline*0.75) $baseline;
color: $base-font-color;
text-transform: none;
}
}
.user-info { .user-info {
@include clearfix(); @include clearfix();
...@@ -51,12 +31,8 @@ ...@@ -51,12 +31,8 @@
@include box-sizing(border-box); @include box-sizing(border-box);
@include clearfix(); @include clearfix();
margin: 0; margin: 0;
border: 1px solid $border-color-2;
border-top: none;
border-radius: 0 0 ($baseline/4) ($baseline/4);
padding: $baseline; padding: $baseline;
width: flex-grid(12); width: flex-grid(12);
background: $white;
li { li {
@include clearfix(); @include clearfix();
...@@ -79,19 +55,22 @@ ...@@ -79,19 +55,22 @@
span { span {
display: block; display: block;
margin-bottom: ($baseline/4);
} }
span.title { span.title {
color: $gray; @extend %t-copy-sub1;
font-family: $sans-serif; @extend %t-strong;
font-size: 13px;
text-transform: uppercase;
a { a {
text-transform: none; text-transform: none;
} }
} }
span.copy {
@extend %t-copy-sub1;
}
span.data { span.data {
color: $base-font-color; color: $base-font-color;
font-weight: 600; font-weight: 600;
...@@ -104,40 +83,6 @@ ...@@ -104,40 +83,6 @@
font-weight: inherit; font-weight: inherit;
} }
.auth-provider {
width: flex-grid(12);
display: block;
margin-top: ($baseline/4);
.status {
width: flex-grid(1);
display: inline-block;
color: $gray-l2;
.fa-link {
color: $base-font-color;
}
.copy {
@extend %text-sr;
}
}
.provider {
width: flex-grid(9);
display: inline-block;
}
.control {
width: flex-grid(2);
display: inline-block;
text-align: right;
a:link, a:visited {
@extend %t-copy-sub2;
}
}
}
} }
} }
...@@ -147,6 +92,17 @@ ...@@ -147,6 +92,17 @@
line-height: 20px; line-height: 20px;
} }
} }
.heads-up {
.title {
display: inline;
}
.copy {
@extend %t-copy-sub2;
display: inline;
}
}
} }
.reverify-status-list { .reverify-status-list {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
%if verification_status == 'approved': %if verification_status == 'approved':
<li class="status status-verification is-accepted"> <li class="status status-verification is-accepted">
<span class="title status-title">${_("ID-Verification Status")}</span> <span class="title status-title">${_("ID Verification Status")}</span>
<div class="status-data"> <div class="status-data">
<span class="status-data-message">${_("Reviewed and Verified")}</span> <span class="status-data-message">${_("Reviewed and Verified")}</span>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
%if verification_status == 'pending': %if verification_status == 'pending':
<li class="status status-verification is-pending"> <li class="status status-verification is-pending">
<span class="title status-title">${_("ID-Verification Status")}</span> <span class="title status-title">${_("ID Verification Status")}</span>
<div class="status-data"> <div class="status-data">
<span class="status-data-message">${_("Pending")}</span> <span class="status-data-message">${_("Pending")}</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment