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
112f8836
Commit
112f8836
authored
Aug 06, 2012
by
Mike Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added permanent link for threads
parent
4167fc88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
lms/djangoapps/django_comment_client/forum/views.py
+6
-4
lms/templates/discussion/_thread.html
+4
-0
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
112f8836
...
...
@@ -136,16 +136,16 @@ def get_annotated_content_info(content, user, is_thread):
'can_delete'
:
check_permissions_by_view
(
user
,
content
,
"delete_thread"
if
is_thread
else
"delete_comment"
),
}
def
get_annotated_content_infos
(
thread
,
user
):
def
get_annotated_content_infos
(
thread
,
user
,
is_thread
=
True
):
infos
=
{}
def
_annotate
(
content
,
is_thread
=
True
):
def
_annotate
(
content
,
is_thread
=
is_thread
):
infos
[
str
(
content
[
'id'
])]
=
get_annotated_content_info
(
content
,
user
,
is_thread
)
for
child
in
content
.
get
(
'children'
,
[]):
_annotate
(
child
,
is_thread
=
False
)
_annotate
(
thread
)
return
infos
def
render_single_thread
(
request
,
course_id
,
thread_id
):
def
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
):
thread
=
comment_client
.
get_thread
(
thread_id
,
recursive
=
True
)
...
...
@@ -153,6 +153,7 @@ def render_single_thread(request, course_id, thread_id):
user
=
request
.
user
,
is_thread
=
True
)
context
=
{
'discussion_id'
:
discussion_id
,
'thread'
:
thread
,
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
...
...
@@ -179,9 +180,10 @@ def single_thread(request, course_id, discussion_id, thread_id):
course
=
check_course
(
course_id
)
context
=
{
'discussion_id'
:
discussion_id
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'content'
:
render_single_thread
(
request
,
course_id
,
thread_id
),
'content'
:
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
'course'
:
course
,
}
...
...
lms/templates/discussion/_thread.html
View file @
112f8836
...
...
@@ -87,6 +87,10 @@
${render_link("discussion-link discussion-reply discussion-reply-" + type, "Reply")}
${render_link("discussion-link discussion-edit", "Edit")}
% if type == "thread":
<a
class=
"discussion-link discussion-permanent-link"
href=
"${reverse('django_comment_client.forum.views.single_thread', kwargs={'discussion_id':discussion_id, 'thread_id':content['id'], 'course_id':course_id})}"
>
Permanent Link
</a>
% endif
<span
class=
"discussion-endorse-control"
>
% if content.get('endorsed', False):
<input
type=
"checkbox"
checked=
"checked"
class=
"discussion-link discussion-endorse"
id=
"discussion-endorse-${content['id']}"
/>
...
...
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