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
46ed9380
Commit
46ed9380
authored
Sep 30, 2016
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review feedback and actual fix
TIL about defining variables in Mako templates.
parent
b3e4e81e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
lms/djangoapps/courseware/tests/test_masquerade.py
+4
-4
lms/djangoapps/courseware/views/index.py
+1
-1
lms/templates/user_dropdown.html
+6
-6
No files found.
lms/djangoapps/courseware/tests/test_masquerade.py
View file @
46ed9380
...
@@ -149,16 +149,16 @@ class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -149,16 +149,16 @@ class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertIn
(
self
.
problem_display_name
,
problem_html
)
self
.
assertIn
(
self
.
problem_display_name
,
problem_html
)
self
.
assertEqual
(
show_answer_expected
,
"Show Answer"
in
problem_html
)
self
.
assertEqual
(
show_answer_expected
,
"Show Answer"
in
problem_html
)
def
verify_
origin
al_user_profile_link
(
self
):
def
verify_
re
al_user_profile_link
(
self
):
"""
"""
Verifies that the 'Profile' link in the navigation dropdown is pointing
Verifies that the 'Profile' link in the navigation dropdown is pointing
to the
origin
al user.
to the
re
al user.
"""
"""
content
=
self
.
get_courseware_page
()
.
content
content
=
self
.
get_courseware_page
()
.
content
self
.
assertIn
(
self
.
assertIn
(
'<a href="/u/{}" class="action dropdown-menuitem">Profile</a>'
.
format
(
self
.
test_user
.
username
),
'<a href="/u/{}" class="action dropdown-menuitem">Profile</a>'
.
format
(
self
.
test_user
.
username
),
content
,
content
,
"Profile link should point to
origin
al user"
,
"Profile link should point to
re
al user"
,
)
)
...
@@ -339,7 +339,7 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
...
@@ -339,7 +339,7 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
self
.
assertEqual
(
self
.
get_progress_detail
(),
u'2/2'
)
self
.
assertEqual
(
self
.
get_progress_detail
(),
u'2/2'
)
# Verify that the user dropdown links have not changed
# Verify that the user dropdown links have not changed
self
.
verify_
origin
al_user_profile_link
()
self
.
verify_
re
al_user_profile_link
()
# Temporarily override the student state.
# Temporarily override the student state.
self
.
submit_answer
(
'Correct'
,
'Incorrect'
)
self
.
submit_answer
(
'Correct'
,
'Incorrect'
)
...
...
lms/djangoapps/courseware/views/index.py
View file @
46ed9380
...
@@ -384,6 +384,7 @@ class CoursewareIndex(View):
...
@@ -384,6 +384,7 @@ class CoursewareIndex(View):
'staff_access'
:
self
.
is_staff
,
'staff_access'
:
self
.
is_staff
,
'studio_url'
:
get_studio_url
(
self
.
course
,
'course'
),
'studio_url'
:
get_studio_url
(
self
.
course
,
'course'
),
'masquerade'
:
self
.
masquerade
,
'masquerade'
:
self
.
masquerade
,
'real_user'
:
self
.
real_user
,
'xqa_server'
:
settings
.
FEATURES
.
get
(
'XQA_SERVER'
,
"http://your_xqa_server.com"
),
'xqa_server'
:
settings
.
FEATURES
.
get
(
'XQA_SERVER'
,
"http://your_xqa_server.com"
),
'bookmarks_api_url'
:
reverse
(
'bookmarks'
),
'bookmarks_api_url'
:
reverse
(
'bookmarks'
),
'language_preference'
:
self
.
_get_language_preference
(),
'language_preference'
:
self
.
_get_language_preference
(),
...
@@ -406,7 +407,6 @@ class CoursewareIndex(View):
...
@@ -406,7 +407,6 @@ class CoursewareIndex(View):
courseware_context
[
'entrance_exam_passed'
]
=
user_has_passed_entrance_exam
(
self
.
request
,
self
.
course
)
courseware_context
[
'entrance_exam_passed'
]
=
user_has_passed_entrance_exam
(
self
.
request
,
self
.
course
)
# staff masquerading data
# staff masquerading data
courseware_context
[
'real_user'
]
=
self
.
real_user
now
=
datetime
.
now
(
UTC
())
now
=
datetime
.
now
(
UTC
())
effective_start
=
_adjust_start_date_for_beta_testers
(
self
.
effective_user
,
self
.
course
,
self
.
course_key
)
effective_start
=
_adjust_start_date_for_beta_testers
(
self
.
effective_user
,
self
.
course
,
self
.
course_key
)
if
not
in_preview_mode
()
and
self
.
is_staff
and
now
<
effective_start
:
if
not
in_preview_mode
()
and
self
.
is_staff
and
now
<
effective_start
:
...
...
lms/templates/user_dropdown.html
View file @
46ed9380
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
## This template should not use the target student's details when masquerading, see TNL-4895
## This template should not use the target student's details when masquerading, see TNL-4895
<
%
<
%
original_user =
real_user
or
user
self
.
real_user =
real_user
if
real_user
!=
UNDEFINED
else
user
%
>
%
>
<
%!
<
%!
...
@@ -19,8 +19,8 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
...
@@ -19,8 +19,8 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
<a
href=
"${reverse('dashboard')}"
class=
"menu-title"
>
<a
href=
"${reverse('dashboard')}"
class=
"menu-title"
>
<span
class=
"sr-only"
>
${_("Dashboard for:")}
</span>
<span
class=
"sr-only"
>
${_("Dashboard for:")}
</span>
<
%
<
%
username =
origin
al_user.username
username =
self.re
al_user.username
profile_image_url =
get_profile_image_urls_for_user(
origin
al_user)['medium']
profile_image_url =
get_profile_image_urls_for_user(
self.re
al_user)['medium']
%
>
%
>
<img
class=
"menu-image"
src=
"${profile_image_url}"
alt=
""
>
<img
class=
"menu-image"
src=
"${profile_image_url}"
alt=
""
>
${username}
${username}
...
@@ -33,7 +33,7 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
...
@@ -33,7 +33,7 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
<ul
class=
"dropdown-menu list-divided is-hidden"
id=
"${_("
Usermenu
")}"
tabindex=
"-1"
>
<ul
class=
"dropdown-menu list-divided is-hidden"
id=
"${_("
Usermenu
")}"
tabindex=
"-1"
>
<
%
block
name=
"navigation_dropdown_menu_links"
>
<
%
block
name=
"navigation_dropdown_menu_links"
>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('dashboard')}"
class=
"action dropdown-menuitem"
>
${_("Dashboard")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('dashboard')}"
class=
"action dropdown-menuitem"
>
${_("Dashboard")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('learner_profile', kwargs={'username':
origin
al_user.username})}"
class=
"action dropdown-menuitem"
>
${_("Profile")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('learner_profile', kwargs={'username':
self.re
al_user.username})}"
class=
"action dropdown-menuitem"
>
${_("Profile")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('account_settings')}"
class=
"action dropdown-menuitem"
>
${_("Account")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('account_settings')}"
class=
"action dropdown-menuitem"
>
${_("Account")}
</a></li>
</
%
block>
</
%
block>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('logout')}"
role=
"menuitem"
class=
"action dropdown-menuitem"
>
${_("Sign Out")}
</a></li>
<li
class=
"dropdown-item item has-block-link"
><a
href=
"${reverse('logout')}"
role=
"menuitem"
class=
"action dropdown-menuitem"
>
${_("Sign Out")}
</a></li>
...
@@ -46,8 +46,8 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
...
@@ -46,8 +46,8 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
<a
href=
"${reverse('dashboard')}"
class=
"user-link"
>
<a
href=
"${reverse('dashboard')}"
class=
"user-link"
>
<span
class=
"sr"
>
${_("Dashboard for:")}
</span>
<span
class=
"sr"
>
${_("Dashboard for:")}
</span>
<
%
<
%
username =
origin
al_user.username
username =
self.re
al_user.username
profile_image_url =
get_profile_image_urls_for_user(
origin
al_user)['medium']
profile_image_url =
get_profile_image_urls_for_user(
self.re
al_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=
"${_('Profile image for {username}').format(username=username)}"
>
<div
class=
"label-username"
>
${username}
</div>
<div
class=
"label-username"
>
${username}
</div>
...
...
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