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
67848ff6
Commit
67848ff6
authored
Mar 26, 2015
by
muzaffaryousaf
Committed by
Andy Armstrong
Apr 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link to learner profile page from username in discussions.
TNL-1503
parent
4f97cd7a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
4 deletions
+31
-4
common/test/acceptance/pages/lms/discussion.py
+6
-2
common/test/acceptance/tests/discussion/test_discussion.py
+20
-0
lms/djangoapps/django_comment_client/forum/views.py
+4
-1
lms/templates/discussion/_user_profile.html
+1
-1
No files found.
common/test/acceptance/pages/lms/discussion.py
View file @
67848ff6
...
...
@@ -444,9 +444,9 @@ class DiscussionUserProfilePage(CoursePage):
return
(
self
.
q
(
css
=
'section.discussion-user-threads[data-course-id="{}"]'
.
format
(
self
.
course_id
))
.
present
and
self
.
q
(
css
=
'section.user-profile
div.sidebar-username
'
)
.
present
self
.
q
(
css
=
'section.user-profile
a.leaner-profile-link
'
)
.
present
and
self
.
q
(
css
=
'section.user-profile
div.sidebar-username
'
)
.
text
[
0
]
==
self
.
username
self
.
q
(
css
=
'section.user-profile
a.leaner-profile-link
'
)
.
text
[
0
]
==
self
.
username
)
@wait_for_js
...
...
@@ -526,6 +526,10 @@ class DiscussionUserProfilePage(CoursePage):
"Window is on top"
)
.
fulfill
()
def
click_on_sidebar_username
(
self
):
self
.
wait_for_page
()
self
.
q
(
css
=
'.leaner-profile-link'
)
.
first
.
click
()
class
DiscussionTabHomePage
(
CoursePage
,
DiscussionPageMixin
):
...
...
common/test/acceptance/tests/discussion/test_discussion.py
View file @
67848ff6
...
...
@@ -19,6 +19,8 @@ from ...pages.lms.discussion import (
DiscussionTabHomePage
,
DiscussionSortPreferencePage
,
)
from
...pages.lms.learner_profile
import
LearnerProfilePage
from
...fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
from
...fixtures.discussion
import
(
SingleThreadViewFixture
,
...
...
@@ -753,6 +755,24 @@ class DiscussionUserProfileTest(UniqueCourseTest):
page
.
wait_for_ajax
()
self
.
assertTrue
(
page
.
is_window_on_top
())
def
test_redirects_to_learner_profile
(
self
):
"""
Scenario: Verify that learner-profile link is present on forum discussions page and we can navigate to it.
Given that I am on discussion forum user's profile page.
And I can see a username on left sidebar
When I click on my username.
Then I will be navigated to Learner Profile page.
And I can my username on Learner Profile page
"""
learner_profile_page
=
LearnerProfilePage
(
self
.
browser
,
self
.
PROFILED_USERNAME
)
page
=
self
.
check_pages
(
1
)
page
.
click_on_sidebar_username
()
learner_profile_page
.
wait_for_page
()
self
.
assertTrue
(
learner_profile_page
.
field_is_visible
(
'username'
))
@attr
(
'shard_1'
)
class
DiscussionSearchAlertTest
(
UniqueCourseTest
):
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
67848ff6
...
...
@@ -9,6 +9,7 @@ import xml.sax.saxutils as saxutils
from
django.contrib.auth.decorators
import
login_required
from
django.core.context_processors
import
csrf
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
User
from
django.http
import
Http404
,
HttpResponseBadRequest
from
django.views.decorators.http
import
require_GET
...
...
@@ -411,16 +412,18 @@ def user_profile(request, course_key, user_id):
'annotated_content_info'
:
_attr_safe_json
(
annotated_content_info
),
})
else
:
django_user
=
User
.
objects
.
get
(
id
=
user_id
)
context
=
{
'course'
:
course
,
'user'
:
request
.
user
,
'django_user'
:
User
.
objects
.
get
(
id
=
user_id
)
,
'django_user'
:
django_user
,
'profiled_user'
:
profiled_user
.
to_dict
(),
'threads'
:
_attr_safe_json
(
threads
),
'user_info'
:
_attr_safe_json
(
user_info
),
'annotated_content_info'
:
_attr_safe_json
(
annotated_content_info
),
'page'
:
query_params
[
'page'
],
'num_pages'
:
query_params
[
'num_pages'
],
'learner_profile_page_url'
:
reverse
(
'learner_profile'
,
kwargs
=
{
'username'
:
django_user
.
username
})
}
return
render_to_response
(
'discussion/user_profile.html'
,
context
)
...
...
lms/templates/discussion/_user_profile.html
View file @
67848ff6
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
,
ungettext
%
>
<
%
def
name=
"span(num)"
><span>
${num}
</span></
%
def>
<div
class=
"user-profile"
>
<div
class=
"sidebar-username"
>
${django_user.username | h}
</div>
<div
class=
"sidebar-username"
>
<a
class=
"leaner-profile-link"
href=
"${learner_profile_page_url}"
>
${django_user.username | h}
</a>
</div>
<div
class=
"sidebar-user-roles"
>
${_(', ').join(sorted(set(map(_, [role.name for role in django_user.roles.all()]))))}
</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