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
4fea82f5
Commit
4fea82f5
authored
Sep 04, 2012
by
Arjun Singh
Committed by
Matthew Mongeau
Sep 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
courseware context links in discussion
parent
3587e460
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
11 deletions
+43
-11
lms/djangoapps/django_comment_client/forum/views.py
+19
-10
lms/djangoapps/django_comment_client/utils.py
+10
-0
lms/static/sass/_discussion.scss
+6
-0
lms/templates/discussion/_underscore_templates.html
+8
-1
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
4fea82f5
...
@@ -234,6 +234,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -234,6 +234,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
=
user_info
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
=
user_info
)
context
=
{
'thread'
:
thread
.
to_dict
(),
'course_id'
:
course_id
}
context
=
{
'thread'
:
thread
.
to_dict
(),
'course_id'
:
course_id
}
# TODO: Remove completely or switch back to server side rendering
html
=
render_to_string
(
'discussion/_ajax_single_thread.html'
,
context
)
html
=
render_to_string
(
'discussion/_ajax_single_thread.html'
,
context
)
return
utils
.
JsonResponse
({
return
utils
.
JsonResponse
({
...
@@ -247,15 +248,23 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -247,15 +248,23 @@ def single_thread(request, course_id, discussion_id, thread_id):
category_map
=
utils
.
get_discussion_category_map
(
course
)
category_map
=
utils
.
get_discussion_category_map
(
course
)
threads
,
query_params
=
get_threads
(
request
,
course_id
)
threads
,
query_params
=
get_threads
(
request
,
course_id
)
recent_active_threads
=
cc
.
search_recent_active_threads
(
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
course_id
,
recursive
=
False
,
for
thread
in
threads
:
query_params
=
{
'follower_id'
:
request
.
user
.
id
},
courseware_context
=
get_courseware_context
(
thread
,
course
)
)
if
courseware_context
:
thread
[
'courseware_location'
]
=
courseware_context
[
'courseware_location'
]
thread
[
'courseware_title'
]
=
courseware_context
[
'courseware_title'
]
#recent_active_threads = cc.search_recent_active_threads(
# course_id,
# recursive=False,
# query_params={'follower_id': request.user.id},
#)
trending_tags
=
cc
.
search_trending_tags
(
#
trending_tags = cc.search_trending_tags(
course_id
,
#
course_id,
)
#
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
escapedict
=
{
'"'
:
'"'
}
escapedict
=
{
'"'
:
'"'
}
...
@@ -272,8 +281,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -272,8 +281,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course'
:
course
,
'course'
:
course
,
'recent_active_threads'
:
recent_active_threads
,
#
'recent_active_threads': recent_active_threads,
'trending_tags'
:
trending_tags
,
#
'trending_tags': trending_tags,
'course_id'
:
course
.
id
,
'course_id'
:
course
.
id
,
'thread_id'
:
thread_id
,
'thread_id'
:
thread_id
,
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
4fea82f5
...
@@ -135,6 +135,16 @@ def initialize_discussion_info(course):
...
@@ -135,6 +135,16 @@ def initialize_discussion_info(course):
_DISCUSSIONINFO
[
'category_map'
]
=
category_map
_DISCUSSIONINFO
[
'category_map'
]
=
category_map
def
get_courseware_context
(
content
,
course
):
id_map
=
get_discussion_id_map
(
course
)
id
=
content
[
'commentable_id'
]
content_info
=
None
if
id
in
id_map
:
location
=
id_map
[
id
][
"location"
]
.
url
()
title
=
id_map
[
id
][
"title"
]
content_info
=
{
"courseware_location"
:
location
,
"courseware_title"
:
title
}
return
content_info
class
JsonResponse
(
HttpResponse
):
class
JsonResponse
(
HttpResponse
):
def
__init__
(
self
,
data
=
None
):
def
__init__
(
self
,
data
=
None
):
content
=
simplejson
.
dumps
(
data
)
content
=
simplejson
.
dumps
(
data
)
...
...
lms/static/sass/_discussion.scss
View file @
4fea82f5
...
@@ -1056,6 +1056,12 @@ body.discussion {
...
@@ -1056,6 +1056,12 @@ body.discussion {
color
:
#888
;
color
:
#888
;
}
}
.post-context
{
margin-top
:
20px
;
font-size
:
12px
;
color
:
#888
;
}
p
+
p
{
p
+
p
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
...
...
lms/templates/discussion/_underscore_templates.html
View file @
4fea82f5
...
@@ -13,8 +13,15 @@
...
@@ -13,8 +13,15 @@
<
div
class
=
"post-body"
>
<
div
class
=
"post-body"
>
$
{
'<%- body %>'
}
$
{
'<%- body %>'
}
<
/div
>
<
/div
>
<
div
class
=
"post-status-closed"
style
=
"display: none"
>
$
{
'<% if (obj.courseware_location) { %>'
}
<
div
class
=
"post-context"
>
(
this
post
is
about
<
a
href
=
"../../jump_to/${'<%- courseware_location %>'}"
>
$
{
'<%- courseware_title %>'
}
<
/a>
)
<
/div
>
$
{
'<% } %>'
}
<
div
class
=
"post-status"
>
$
{
'<% if (closed) { %>'
}
This
thread
is
closed
.
This
thread
is
closed
.
$
{
'<% } %>'
}
<
/div
>
<
/div
>
<
ul
class
=
"moderator-actions"
>
<
ul
class
=
"moderator-actions"
>
<
li
style
=
"display: none"
><
a
class
=
"action-edit"
href
=
"javascript:void(0)"
><
span
class
=
"edit-icon"
><
/span> Edit</
a
><
/li
>
<
li
style
=
"display: none"
><
a
class
=
"action-edit"
href
=
"javascript:void(0)"
><
span
class
=
"edit-icon"
><
/span> Edit</
a
><
/li
>
...
...
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