Commit d696677c by Diana Huang Committed by GitHub

Merge pull request #15968 from edx/diana/header-updates

LEARNER-2318: As a learner I should have an easy way to get to my learner profile
parents 9a07227e de7e1ead
......@@ -864,6 +864,7 @@ def dashboard(request):
'nav_hidden': True,
'inverted_programs': inverted_programs,
'show_program_listing': ProgramsApiConfig.is_enabled(),
'show_dashboard_tabs': True,
'disable_courseware_js': True,
'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard,
'display_sidebar_on_dashboard': display_sidebar_on_dashboard,
......
......@@ -217,11 +217,18 @@ class DashboardPage(PageObject):
"""
return self.q(css='.user-dropdown-menu li a').text
@property
def tabs_link_text(self):
"""
Return the text of all the tabs on the dashboard.
"""
return self.q(css='.tab-nav-item a').text
def click_my_profile_link(self):
"""
Click on `Profile` link.
"""
self.q(css='.user-dropdown-menu li a').nth(1).click()
self.q(css='.tab-nav-item a').nth(1).click()
def click_account_settings_link(self):
"""
......
......@@ -278,8 +278,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, AcceptanceTest):
username, __ = self.log_in_as_unique_user()
dashboard_page = DashboardPage(self.browser)
dashboard_page.visit()
dashboard_page.click_username_dropdown()
self.assertIn('Profile', dashboard_page.username_dropdown_link_text)
self.assertIn('Profile', dashboard_page.tabs_link_text)
dashboard_page.click_my_profile_link()
my_profile_page = LearnerProfilePage(self.browser, username)
my_profile_page.wait_for_page()
......
......@@ -154,20 +154,6 @@ class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertIn(self.problem_display_name, problem_html)
self.assertEqual(show_answer_expected, "Show Answer" in problem_html)
def verify_real_user_profile_link(self):
"""
Verifies that the 'Profile' link in the navigation dropdown is pointing
to the real user.
"""
content = self.get_courseware_page().content
self.assertIn(
'<a href="/u/{}" role="menuitem" class="action dropdown-menuitem">Profile</a>'.format(
self.test_user.username
),
content,
"Profile link should point to real user",
)
def ensure_masquerade_as_group_member(self, partition_id, group_id):
"""
Installs a masquerade for the test_user and test course, to enable the
......@@ -376,9 +362,6 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
self.update_masquerade(role='student', user_name=self.student_user.username)
self.assertEqual(self.get_progress_detail(), u'2/2')
# Verify that the user dropdown links have not changed
self.verify_real_user_profile_link()
# Temporarily override the student state.
self.submit_answer('Correct', 'Incorrect')
self.assertEqual(self.get_progress_detail(), u'1/2')
......@@ -461,7 +444,6 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
masquerade_progress = self.get_progress_page().content
self.assertNotIn("1 of 2 possible points", masquerade_progress)
self.assertIn("2 of 2 possible points", masquerade_progress)
self.verify_real_user_profile_link()
@attr(shard=1)
......
......@@ -35,6 +35,7 @@ def program_listing(request):
'programs': meter.engaged_programs,
'progress': meter.progress(),
'show_program_listing': programs_config.enabled,
'show_dashboard_tabs': True,
'uses_pattern_library': True,
}
......@@ -75,6 +76,7 @@ def program_details(request, program_uuid):
context = {
'urls': urls,
'show_program_listing': programs_config.enabled,
'show_dashboard_tabs': True,
'nav_hidden': True,
'disable_courseware_js': True,
'uses_pattern_library': True,
......
......@@ -555,6 +555,7 @@ def account_settings_context(request):
'user_preferences_api_url': reverse('preferences_api', kwargs={'username': user.username}),
'disable_courseware_js': True,
'show_program_listing': ProgramsApiConfig.is_enabled(),
'show_dashboard_tabs': True,
'order_history': user_orders
}
......
......@@ -5,7 +5,7 @@
default = learner:index.html
instructor = course_author:CA_instructor_dash_help.html
course = learner:index.html
profile = learner:SFD_dashboard_profile_SectionHead.html
profile = learner:SFD_dashboard_profile_SectionHead.html#adding-profile-information
dashboard = learner:SFD_dashboard_profile_SectionHead.html
courseinfo = learner:SFD_start_course.html
progress = learner:SFD_check_progress.html
......
......@@ -33,15 +33,26 @@ from django.utils.translation import ugettext as _
</li>
% endif
% if show_program_listing:
% if show_dashboard_tabs:
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="nav-link ${'active' if reverse('dashboard') == request.path else ''}" href="${reverse('dashboard')}">
${_("Courses")}
</a>
</li>
% if show_program_listing:
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="nav-link ${'active' if reverse('program_listing_view') in request.path else ''}" href="${reverse('program_listing_view')}">
${_("Programs")}
</a>
</li>
% endif
<%
self.real_user = getattr(user, 'real_user', user)
is_on_profile_page = data and data.get('profile_user_id') is not None
%>
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="nav-link ${'active' if reverse('program_listing_view') in request.path else ''}" href="${reverse('program_listing_view')}">
${_("Programs")}
<a class="${'active ' if is_on_profile_page else ''}tab-nav-link" href="${reverse('learner_profile', args=[self.real_user.username])}">
${_("Profile")}
</a>
</li>
% endif
......
......@@ -16,15 +16,26 @@ from django.utils.translation import ugettext as _
<a class="btn" href="${marketing_link('COURSES')}">${_('Explore courses')}</a>
</li>
% endif
% if show_program_listing:
% if show_dashboard_tabs:
<li class="tab-nav-item">
<a class="${'active ' if reverse('dashboard') == request.path else ''}tab-nav-link" href="${reverse('dashboard')}">
${_("Courses")}
</a>
</li>
% if show_program_listing:
<li class="tab-nav-item">
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
</a>
</li>
% endif
<%
self.real_user = getattr(user, 'real_user', user)
is_on_profile_page = data and data.get('profile_user_id') is not None
%>
<li class="tab-nav-item">
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
<a class="${'active ' if is_on_profile_page else ''}tab-nav-link" href="${reverse('learner_profile', args=[self.real_user.username])}">
${_("Profile")}
</a>
</li>
% endif
......
......@@ -4,6 +4,7 @@
<%namespace name='static' file='../static_content.html'/>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from lms.djangoapps.ccx.overrides import get_current_ccx
......@@ -13,7 +14,7 @@ from branding import api as branding_api
<h1 class="hd logo-header">
<div class="logo">
<a href="${marketing_link('ROOT')}">
<a href="${reverse('dashboard')}">
<%block name="navigation_logo">
<img src="${branding_api.get_logo_url(is_secure)}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
</%block>
......
......@@ -26,13 +26,11 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">${username}</a>
<ul class="dropdown-menu dropdown-menu-right" id="${_("Usermenu")}" aria-labelledby="dropdownMenuLink" tabindex="-1">
<a class="dropdown-item" href="${reverse('dashboard')}">${_("Dashboard")}</a>
<a class="dropdown-item" href="${reverse('learner_profile', kwargs={'username': self.real_user.username})}">${_("Profile")}</a>
<a class="dropdown-item" href="${reverse('account_settings')}">${_("Account")}</a>
<a class="dropdown-item" href="${reverse('logout')}">${_("Sign Out")}</a>
</ul>
</li>
<li class="nav-item nav-item-open-collapsed-only collapse"><a href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
<li class="nav-item nav-item-open-collapsed-only"><a href="${reverse('learner_profile', kwargs={'username': self.real_user.username})}">${_("Profile")}</a></li>
<li class="nav-item nav-item-open-collapsed-only"><a href="${reverse('account_settings')}">${_("Account")}</a></li>
<li class="nav-item nav-item-open-collapsed-only"><a href="${reverse('logout')}">${_("Sign Out")}</a></li>
% elif uses_pattern_library:
......@@ -54,7 +52,6 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
<ul class="dropdown-menu list-divided is-hidden" id="${_("Usermenu")}" tabindex="-1">
<%block name="navigation_dropdown_menu_links" >
<li class="dropdown-item item has-block-link"><a href="${reverse('dashboard')}" role="menuitem" class="action dropdown-menuitem">${_("Dashboard")}</a></li>
<li class="dropdown-item item has-block-link"><a href="${reverse('learner_profile', kwargs={'username': self.real_user.username})}" role="menuitem" class="action dropdown-menuitem">${_("Profile")}</a></li>
<li class="dropdown-item item has-block-link"><a href="${reverse('account_settings')}" role="menuitem" class="action dropdown-menuitem">${_("Account")}</a></li>
</%block>
<li class="dropdown-item item has-block-link"><a href="${reverse('logout')}" role="menuitem" class="action dropdown-menuitem">${_("Sign Out")}</a></li>
......
......@@ -12,6 +12,7 @@ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_http_methods
from django_countries import countries
from edxmako.shortcuts import marketing_link
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
from openedx.core.djangoapps.user_api.errors import UserNotAuthorized, UserNotFound
......@@ -134,7 +135,10 @@ def learner_profile_context(request, profile_username, user_is_staff):
'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
'social_platforms': settings.SOCIAL_PLATFORMS,
},
'show_program_listing': ProgramsApiConfig.is_enabled(),
'show_dashboard_tabs': True,
'disable_courseware_js': True,
'nav_hidden': True,
}
if badges_enabled():
......
......@@ -56,7 +56,7 @@ site_status_msg = get_site_status_msg(course_id)
<nav class="navbar navbar-expand-lg navbar-light" aria-label="${_('Main')}">
<h1 class="hd logo-header">
<div class="logo">
<a class="navbar-brand" href="${marketing_link('ROOT')}" itemprop="url">
<a class="navbar-brand" href="${reverse('dashboard')}" itemprop="url">
<img src="${static.url("images/logo.png")}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}" itemprop="logo" />
</a>
</div>
......@@ -74,7 +74,7 @@ site_status_msg = get_site_status_msg(course_id)
% if user.is_authenticated():
<div class="collapse navbar-collapse" id="navbarSupportedContent">
% if not course or disable_courseware_header:
% if not nav_hidden or show_program_listing:
% if not nav_hidden or show_dashboard_tabs:
<ul class="navbar-nav mr-auto">
% if not nav_hidden:
<li class="nav-item mt-2 nav-item-open-collapsed nav-global-01">
......@@ -87,18 +87,29 @@ site_status_msg = get_site_status_msg(course_id)
<a class="nav-link" href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
</li>
% endif
% if show_program_listing:
% if show_dashboard_tabs:
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="${'active' if reverse('dashboard') == request.path else ''} nav-link" href="${reverse('dashboard')}">
${_("Courses")}
</a>
</li>
% if show_program_listing:
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="${'active' if reverse('program_listing_view') in request.path else ''} nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
</a>
</li>
% endif
<%
self.real_user = getattr(user, 'real_user', user)
is_on_profile_page = data and data.get('profile_user_id') is not None
%>
<li class="nav-item mt-2 nav-item-open-collapsed">
<a class="${'active' if reverse('program_listing_view') in request.path else ''} nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
<a class="${'active ' if is_on_profile_page else ''}tab-nav-link" href="${reverse('learner_profile', args=[self.real_user.username])}">
${_("Profile")}
</a>
</li>
% endif
% endif
</ul>
% endif
% endif
......@@ -166,7 +177,7 @@ site_status_msg = get_site_status_msg(course_id)
% if user.is_authenticated():
% if not course or disable_courseware_header:
% if not nav_hidden or show_program_listing:
% if not nav_hidden or show_dashboard_tabs:
<nav aria-label="${_('Main')}" class="nav-main">
<ul class="left list-inline nav-global authenticated">
% if not nav_hidden:
......@@ -182,17 +193,29 @@ site_status_msg = get_site_status_msg(course_id)
</li>
</%block>
% endif
% if show_program_listing:
% if show_dashboard_tabs:
<li class="tab-nav-item">
<a class="${'active ' if reverse('dashboard') == request.path else ''}tab-nav-link" href="${reverse('dashboard')}">
${_("Courses")}
</a>
</li>
% if show_program_listing:
<li class="tab-nav-item">
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
</a>
</li>
% endif
<%
self.real_user = getattr(user, 'real_user', user)
is_on_profile_page = data and data.get('profile_user_id') is not None
%>
<li class="tab-nav-item">
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
${_("Programs")}
<a class="${'active ' if is_on_profile_page else ''}tab-nav-link" href="${reverse('learner_profile', args=[self.real_user.username])}">
${_("Profile")}
</a>
</li>
% endif
</ul>
</nav>
......
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