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
4778002b
Commit
4778002b
authored
Sep 04, 2012
by
Tom Giannattasio
Browse files
Options
Browse Files
Download
Plain Diff
fixed merge conflict
parents
4a3f85b4
fb88df45
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
20 deletions
+51
-20
lms/djangoapps/django_comment_client/forum/views.py
+28
-11
lms/djangoapps/django_comment_client/utils.py
+9
-9
lms/static/sass/_discussion.scss
+6
-0
lms/templates/discussion/_underscore_templates.html
+8
-0
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
4778002b
...
...
@@ -13,7 +13,7 @@ from courseware.access import has_access
from
urllib
import
urlencode
from
operator
import
methodcaller
from
django_comment_client.permissions
import
check_permissions_by_view
from
django_comment_client.utils
import
merge_dict
,
extract
,
strip_none
,
strip_blank
from
django_comment_client.utils
import
merge_dict
,
extract
,
strip_none
,
strip_blank
,
get_courseware_context
import
json
import
django_comment_client.utils
as
utils
...
...
@@ -71,6 +71,15 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
annotated_content_info
=
reduce
(
merge_dict
,
map
(
infogetter
,
threads
),
{})
if
discussion_type
!=
'inline'
:
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
for
thread
in
threads
:
courseware_context
=
get_courseware_context
(
thread
,
course
)
if
courseware_context
:
thread
[
'courseware_location'
]
=
courseware_context
[
'courseware_location'
]
thread
[
'courseware_title'
]
=
courseware_context
[
'courseware_title'
]
context
=
{
'threads'
:
threads
,
'discussion_id'
:
discussion_id
,
...
...
@@ -231,15 +240,23 @@ def single_thread(request, course_id, discussion_id, thread_id):
category_map
=
utils
.
get_discussion_category_map
(
course
)
threads
,
query_params
=
get_threads
(
request
,
course_id
)
recent_active_threads
=
cc
.
search_recent_active_threads
(
course_id
,
recursive
=
False
,
query_params
=
{
'follower_id'
:
request
.
user
.
id
},
)
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
for
thread
in
threads
:
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
(
course_id
,
)
#
trending_tags = cc.search_trending_tags(
#
course_id,
#
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
escapedict
=
{
'"'
:
'"'
}
...
...
@@ -256,8 +273,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
'user_info'
:
saxutils
.
escape
(
json
.
dumps
(
user_info
),
escapedict
),
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course'
:
course
,
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
#
'recent_active_threads': recent_active_threads,
#
'trending_tags': trending_tags,
'course_id'
:
course
.
id
,
'thread_id'
:
thread_id
,
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
4778002b
...
...
@@ -124,10 +124,7 @@ def initialize_discussion_info(course):
category_map
[
'entries'
][
topic
]
=
{
"id"
:
entry
[
"id"
],
"sort_key"
:
entry
.
get
(
"sort_key"
,
topic
)}
sort_map_entries
(
category_map
)
#for level in category_map["subcategories"].values():
# sort_map_entries(level)
_DISCUSSIONINFO
=
{}
...
...
@@ -135,12 +132,15 @@ def initialize_discussion_info(course):
_DISCUSSIONINFO
[
'category_map'
]
=
category_map
# TODO delete me when you've used me
#_DISCUSSIONINFO['categorized']['General'] = [{
# 'title': 'General',
# 'discussion_id': url_course_id,
# 'category': 'General',
#}]
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
):
def
__init__
(
self
,
data
=
None
):
...
...
lms/static/sass/_discussion.scss
View file @
4778002b
...
...
@@ -1074,6 +1074,12 @@ body.discussion {
color
:
#888
;
}
.post-context
{
margin-top
:
20px
;
font-size
:
12px
;
color
:
#888
;
}
p
+
p
{
margin-top
:
20px
;
}
...
...
lms/templates/discussion/_underscore_templates.html
View file @
4778002b
...
...
@@ -13,6 +13,14 @@
<
div
class
=
"post-body"
>
$
{
'<%- body %>'
}
<
/div
>
$
{
'<% 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-closed"
style
=
"display: none"
>
This
thread
is
closed
.
<
/div
>
<
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-delete"
href
=
"javascript:void(0)"
><
span
class
=
"delete-icon"
><
/span> Delete</
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