Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
caa5a0ac
Commit
caa5a0ac
authored
May 05, 2016
by
Tasawer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECOM-4334 Update learner dashboard
parent
18cddf6e
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
41 deletions
+96
-41
common/test/acceptance/pages/lms/dashboard.py
+6
-0
common/test/acceptance/tests/lms/test_learner_profile.py
+3
-7
lms/djangoapps/student_account/test/test_views.py
+22
-3
lms/djangoapps/student_account/views.py
+2
-0
lms/djangoapps/student_profile/test/test_views.py
+23
-3
lms/djangoapps/student_profile/views.py
+2
-0
lms/templates/navigation.html
+11
-3
lms/templates/user_dropdown.html
+5
-7
themes/edx.org/lms/templates/header.html
+22
-18
No files found.
common/test/acceptance/pages/lms/dashboard.py
View file @
caa5a0ac
...
...
@@ -174,6 +174,12 @@ class DashboardPage(PageObject):
"""
self
.
q
(
css
=
'.dropdown'
)
.
first
.
click
()
def
click_username
(
self
):
"""
Click username.
"""
self
.
q
(
css
=
'.label-username'
)
.
first
.
click
()
@property
def
username_dropdown_link_text
(
self
):
"""
...
...
common/test/acceptance/tests/lms/test_learner_profile.py
View file @
caa5a0ac
...
...
@@ -266,21 +266,17 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
def
test_dashboard_learner_profile_link
(
self
):
"""
Scenario: Verify that
my profile link is present on dashboard page and we can navigate to correct
page.
Scenario: Verify that
when user click on username it will leads to profile
page.
Given that I am a registered user.
When I go to Dashboard page.
And I click on username dropdown.
Then I see Profile link in the dropdown menu.
When I click on Profile link.
And I click on username.
Then I will be navigated to Profile page.
"""
username
,
user_id
=
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
)
dashboard_page
.
click_my_profile_link
()
dashboard_page
.
click_username
()
my_profile_page
=
LearnerProfilePage
(
self
.
browser
,
username
)
my_profile_page
.
wait_for_page
()
...
...
lms/djangoapps/student_account/test/test_views.py
View file @
caa5a0ac
...
...
@@ -19,6 +19,7 @@ from django.test.utils import override_settings
from
django.http
import
HttpRequest
from
course_modes.models
import
CourseMode
from
openedx.core.djangoapps.programs.tests.mixins
import
ProgramsApiConfigMixin
from
openedx.core.djangoapps.user_api.accounts.api
import
activate_account
,
create_account
from
openedx.core.djangoapps.user_api.accounts
import
EMAIL_MAX_LENGTH
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
...
...
@@ -442,7 +443,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
})
class
AccountSettingsViewTest
(
ThirdPartyAuthTestMixin
,
TestCase
):
class
AccountSettingsViewTest
(
ThirdPartyAuthTestMixin
,
TestCase
,
ProgramsApiConfigMixin
):
""" Tests for the account settings view. """
USERNAME
=
'student'
...
...
@@ -456,6 +457,7 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase):
'year_of_birth'
,
'preferred_language'
,
]
view_path
=
reverse
(
'account_settings'
)
@mock.patch
(
"django.conf.settings.MESSAGE_STORAGE"
,
'django.contrib.messages.storage.cookie.CookieStorage'
)
def
setUp
(
self
):
...
...
@@ -502,12 +504,29 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase):
def
test_view
(
self
):
view_path
=
reverse
(
'account_settings'
)
response
=
self
.
client
.
get
(
path
=
view_path
)
response
=
self
.
client
.
get
(
path
=
self
.
view_path
)
for
attribute
in
self
.
FIELDS
:
self
.
assertIn
(
attribute
,
response
.
content
)
def
test_header_with_programs_listing_enabled
(
self
):
"""
Verify that tabs header will be shown while program listing is enabled.
"""
self
.
create_programs_config
(
program_listing_enabled
=
True
)
response
=
self
.
client
.
get
(
path
=
self
.
view_path
)
self
.
assertContains
(
response
,
'<li class="tab-nav-item">'
)
def
test_header_with_programs_listing_disabled
(
self
):
"""
Verify that nav header will be shown while program listing is disabled.
"""
self
.
create_programs_config
(
program_listing_enabled
=
False
)
response
=
self
.
client
.
get
(
path
=
self
.
view_path
)
self
.
assertContains
(
response
,
'<li class="item nav-global-01">'
)
@override_settings
(
SITE_NAME
=
settings
.
MICROSITE_LOGISTRATION_HOSTNAME
)
class
MicrositeLogistrationTests
(
TestCase
):
...
...
lms/djangoapps/student_account/views.py
View file @
caa5a0ac
...
...
@@ -36,6 +36,7 @@ from third_party_auth import pipeline
from
third_party_auth.decorators
import
xframe_allow_whitelisted
from
util.bad_request_rate_limiter
import
BadRequestRateLimiter
from
openedx.core.djangoapps.programs.models
import
ProgramsApiConfig
from
openedx.core.djangoapps.theming.helpers
import
is_request_in_themed_site
,
get_value
as
get_themed_value
from
openedx.core.djangoapps.user_api.accounts.api
import
request_password_change
from
openedx.core.djangoapps.user_api.errors
import
UserNotFound
...
...
@@ -394,6 +395,7 @@ def account_settings_context(request):
'user_accounts_api_url'
:
reverse
(
"accounts_api"
,
kwargs
=
{
'username'
:
user
.
username
}),
'user_preferences_api_url'
:
reverse
(
'preferences_api'
,
kwargs
=
{
'username'
:
user
.
username
}),
'disable_courseware_js'
:
True
,
'show_program_listing'
:
ProgramsApiConfig
.
current
()
.
show_program_listing
,
}
if
third_party_auth
.
is_enabled
():
...
...
lms/djangoapps/student_profile/test/test_views.py
View file @
caa5a0ac
...
...
@@ -6,13 +6,13 @@ from django.core.urlresolvers import reverse
from
django.test
import
TestCase
from
django.test.client
import
RequestFactory
from
util.testing
import
UrlReset
Mixin
from
openedx.core.djangoapps.programs.tests.mixins
import
ProgramsApiConfig
Mixin
from
student.tests.factories
import
UserFactory
from
student_profile.views
import
learner_profile_context
from
util.testing
import
UrlResetMixin
class
LearnerProfileViewTest
(
UrlResetMixin
,
TestCase
):
class
LearnerProfileViewTest
(
UrlResetMixin
,
TestCase
,
ProgramsApiConfigMixin
):
""" Tests for the student profile view. """
USERNAME
=
"username"
...
...
@@ -101,3 +101,23 @@ class LearnerProfileViewTest(UrlResetMixin, TestCase):
profile_path
=
reverse
(
'learner_profile'
,
kwargs
=
{
'username'
:
"no_such_user"
})
response
=
self
.
client
.
get
(
path
=
profile_path
)
self
.
assertEqual
(
404
,
response
.
status_code
)
def
test_header_with_programs_listing_enabled
(
self
):
"""
Verify that tabs header will be shown while program listing is enabled.
"""
self
.
create_programs_config
(
program_listing_enabled
=
True
)
profile_path
=
reverse
(
'learner_profile'
,
kwargs
=
{
'username'
:
self
.
USERNAME
})
response
=
self
.
client
.
get
(
path
=
profile_path
)
self
.
assertContains
(
response
,
'<li class="tab-nav-item">'
)
def
test_header_with_programs_listing_disabled
(
self
):
"""
Verify that nav header will be shown while program listing is disabled.
"""
self
.
create_programs_config
(
program_listing_enabled
=
False
)
profile_path
=
reverse
(
'learner_profile'
,
kwargs
=
{
'username'
:
self
.
USERNAME
})
response
=
self
.
client
.
get
(
path
=
profile_path
)
self
.
assertContains
(
response
,
'<li class="item nav-global-01">'
)
lms/djangoapps/student_profile/views.py
View file @
caa5a0ac
...
...
@@ -12,6 +12,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
from
badges.utils
import
badges_enabled
from
edxmako.shortcuts
import
render_to_response
,
marketing_link
from
microsite_configuration
import
microsite
from
openedx.core.djangoapps.programs.models
import
ProgramsApiConfig
from
openedx.core.djangoapps.user_api.accounts.api
import
get_account_settings
from
openedx.core.djangoapps.user_api.errors
import
UserNotFound
,
UserNotAuthorized
from
openedx.core.djangoapps.user_api.preferences.api
import
get_user_preferences
...
...
@@ -95,6 +96,7 @@ def learner_profile_context(request, profile_username, user_is_staff):
'platform_name'
:
microsite
.
get_value
(
'platform_name'
,
settings
.
PLATFORM_NAME
),
},
'disable_courseware_js'
:
True
,
'show_program_listing'
:
ProgramsApiConfig
.
current
()
.
show_program_listing
,
}
if
badges_enabled
():
...
...
lms/templates/navigation.html
View file @
caa5a0ac
...
...
@@ -50,11 +50,19 @@ site_status_msg = get_site_status_msg(course_id)
<header
id=
"global-navigation"
class=
"header-global ${"
slim
"
if
course
else
""}"
>
<nav
class=
"wrapper-header"
aria-label=
"${_('Global')}"
>
<h1
class=
"logo"
>
<a
href=
"${marketing_link('ROOT')}"
>
<
%
block
name=
"navigation_logo"
>
<img
src=
"${static.url(branding_api.get_logo_url())}"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"/
>
</
%
block>
% if user.is_authenticated():
<a
href=
"${reverse('dashboard')}"
>
<img
src=
"${static.url(branding_api.get_logo_url())}"
alt=
${_("Your
Dashboard
")}
/>
</a>
% else:
<a
href=
"${marketing_link('ROOT')}"
>
<img
src=
"${static.url(branding_api.get_logo_url())}"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"/
>
</a>
% endif
</
%
block>
</h1>
% if course:
...
...
lms/templates/user_dropdown.html
View file @
caa5a0ac
...
...
@@ -28,8 +28,6 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
</button>
<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')}"
class=
"action"
>
${_("Dashboard")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('learner_profile', kwargs={'username': user.username})}"
class=
"action"
>
${_("Profile")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('account_settings')}"
class=
"action"
>
${_("Account")}
</a></li>
</
%
block>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('logout')}"
role=
"menuitem"
class=
"action"
>
${_("Sign Out")}
</a></li>
...
...
@@ -38,19 +36,19 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
% else:
<ol
class=
"user"
>
<li
class=
"primary"
>
<a
href=
"${reverse('
dashboard'
)}"
class=
"user-link"
>
<span
class=
"sr"
>
${_("
Dashboard
for:")}
</span>
<a
href=
"${reverse('
learner_profile', kwargs={'username': user.username}
)}"
class=
"user-link"
>
<span
class=
"sr"
>
${_("
Profile
for:")}
</span>
<
%
username =
user.username
profile_image_url =
get_profile_image_urls_for_user(user)['medium']
%
>
<img
class=
"user-image-frame"
src=
"${profile_image_url}"
alt=
"
${_('Profile image for {username}').format(username=username)}
"
>
<img
class=
"user-image-frame"
src=
"${profile_image_url}"
alt=
""
>
<div
class=
"label-username"
>
${username}
</div>
</a>
</li>
<li
class=
"primary"
>
<button
class=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
><span
class=
"sr"
>
${_("More options dropdown")}
</span
><span
class=
"fa fa-sort-desc"
aria-hidden=
"true"
></span></button>
<ul
class=
"dropdown-menu"
aria-label=
"More Options"
role=
"menu"
>
<button
class=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
title=
${_("Account
settings
menu
")}
><span
class=
"fa fa-sort-desc"
aria-hidden=
"true"
></span></button>
<ul
class=
"dropdown-menu"
aria-label=
${_("Account
settings
")}
role=
"menu"
>
${navigation_dropdown_menu_links()}
<li
class=
"item"
><a
href=
"${reverse('logout')}"
role=
"menuitem"
>
${_("Sign Out")}
</a></li>
</ul>
...
...
themes/edx.org/lms/templates/header.html
View file @
caa5a0ac
...
...
@@ -51,11 +51,18 @@ site_status_msg = get_site_status_msg(course_id)
% endif
<div
class=
"${"
rwd
"
if
responsive
else
""}
wrapper-header
nav-container
"
>
<h1
class=
"logo"
itemscope=
""
itemtype=
"http://schema.org/Organization"
>
<a
href=
"${marketing_link('ROOT')}"
itemprop=
"url"
>
<
%
block
name=
"navigation_logo"
>
<img
src=
"${static.url("
images
/
logo
.
png
")}"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"
itemprop=
"logo"
/>
</
%
block>
% if user.is_authenticated():
<a
href=
"${reverse('dashboard')}"
>
<img
src=
"${static.url("
images
/
logo
.
png
")}"
alt=
${_("Your
Dashboard
")}
/>
</a>
% else:
<a
href=
"${marketing_link('ROOT')}"
itemprop=
"url"
>
<img
src=
"${static.url("
images
/
logo
.
png
")}"
itemprop=
"logo"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"/
>
</a>
% endif
</
%
block>
</h1>
% if course and not disable_courseware_header:
...
...
@@ -69,22 +76,8 @@ 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:
<nav
aria-label=
"Main"
class=
"nav-main"
>
<ul
class=
"left list-inline nav-global authenticated"
>
% if not nav_hidden:
<
%
block
name=
"navigation_global_links_authenticated"
>
<li
class=
"item nav-global-01"
>
<a
href=
"${marketing_link('HOW_IT_WORKS')}"
>
${_("How it Works")}
</a>
</li>
<li
class=
"item nav-global-02"
>
<a
href=
"${marketing_link('COURSES')}"
>
${_("Find Courses")}
</a>
</li>
<li
class=
"item nav-global-03"
>
<a
href=
"${marketing_link('SCHOOLS')}"
>
${_("Schools
&
Partners")}
</a>
</li>
</
%
block>
% endif
% if show_program_listing:
<li
class=
"tab-nav-item"
>
<a
class=
"${'active ' if reverse('dashboard') == request.path else ''}tab-nav-link"
href=
"${reverse('dashboard')}"
>
...
...
@@ -96,11 +89,22 @@ site_status_msg = get_site_status_msg(course_id)
${_("Programs")}
</a>
</li>
% elif not nav_hidden:
<
%
block
name=
"navigation_global_links_authenticated"
>
<li
class=
"item nav-global-01"
>
<a
href=
"${marketing_link('HOW_IT_WORKS')}"
>
${_("How it Works")}
</a>
</li>
<li
class=
"item nav-global-02"
>
<a
href=
"${marketing_link('COURSES')}"
>
${_("Find Courses")}
</a>
</li>
<li
class=
"item nav-global-03"
>
<a
href=
"${marketing_link('SCHOOLS')}"
>
${_("Schools
&
Partners")}
</a>
</li>
</
%
block>
% endif
</ul>
</nav>
% endif
% endif
<
%
include
file=
"user_dropdown.html"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment