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
44f7b37b
Commit
44f7b37b
authored
Aug 12, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored comment_client working
parent
b7d33618
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
80 deletions
+68
-80
lms/djangoapps/django_comment_client/base/views.py
+58
-59
lms/djangoapps/django_comment_client/forum/views.py
+6
-7
lms/static/coffee/src/discussion/content.coffee
+0
-2
lms/static/coffee/src/discussion/discussion.coffee
+0
-1
lms/static/coffee/src/discussion/utils.coffee
+0
-1
lms/templates/discussion/_inline.html
+4
-10
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
44f7b37b
This diff is collapsed.
Click to expand it.
lms/djangoapps/django_comment_client/forum/views.py
View file @
44f7b37b
...
...
@@ -59,7 +59,7 @@ def render_discussion(request, course_id, threads, discussion_id=None, \
context
=
{
'threads'
:
threads
,
'discussion_id'
:
discussion_id
,
'user_info'
:
dict
(
cc
.
User
.
from_django_user
(
request
.
user
)),
#comment_client.get_user_info(request.user.id, raw=True
),
'user_info'
:
json
.
dumps
(
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
),
'course_id'
:
course_id
,
'request'
:
request
,
'performed_search'
:
_should_perform_search
(
request
),
...
...
@@ -90,7 +90,6 @@ def get_threads(request, course_id, discussion_id):
'course_id'
:
course_id
,
}
import
pdb
;
pdb
.
set_trace
()
threads
,
page
,
num_pages
=
cc
.
Thread
.
search
(
query_params
)
#if _should_perform_search(request):
...
...
@@ -172,16 +171,16 @@ def get_annotated_content_infos(course_id, thread, user, is_thread=True):
def
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
):
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
_with_comments
(
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
#comment_client.get_thread(thread_id, recursive=True)
annotated_content_info
=
get_annotated_content_infos
(
course_id
,
thread
=
dict
(
thread
),
\
annotated_content_info
=
get_annotated_content_infos
(
course_id
,
thread
=
thread
.
to_dict
(
),
\
user
=
request
.
user
,
is_thread
=
True
)
context
=
{
'discussion_id'
:
discussion_id
,
'thread'
:
thread
,
'user_info'
:
dict
(
cc
.
User
.
from_django_user
(
request
.
user
)
),
#get_user_info(request.user.id, raw=True),
'user_info'
:
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
(
),
#get_user_info(request.user.id, raw=True),
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'course_id'
:
course_id
,
'request'
:
request
,
...
...
@@ -192,9 +191,9 @@ def single_thread(request, course_id, discussion_id, thread_id):
if
request
.
is_ajax
():
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
_with_comments
()
#comment_client.get_thread(thread_id,
recursive=True)
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
annotated_content_info
=
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
)
context
=
{
'thread'
:
dict
(
thread
)}
context
=
{
'thread'
:
thread
.
to_dict
(
)}
html
=
render_to_string
(
'discussion/_ajax_single_thread.html'
,
context
)
return
utils
.
JsonResponse
({
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
44f7b37b
...
...
@@ -183,8 +183,6 @@ initializeFollowThread = (thread) ->
handleEndorse
=
(
elem
,
endorsed
)
->
url
=
Discussion
.
urlFor
(
'endorse_comment'
,
id
)
console
.
log
endorsed
console
.
log
url
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
url
...
...
lms/static/coffee/src/discussion/discussion.coffee
View file @
44f7b37b
...
...
@@ -79,7 +79,6 @@ initializeFollowDiscussion = (discussion) ->
data
:
text
:
$local
(
".new-post-title"
).
val
()
success
:
(
response
,
textStatus
)
->
console
.
log
"request"
$similarPosts
.
empty
()
if
$
.
type
(
response
)
==
"array"
and
response
.
length
$wrapper
.
show
()
...
...
lms/static/coffee/src/discussion/utils.coffee
View file @
44f7b37b
...
...
@@ -116,7 +116,6 @@ wmdEditors = {}
appended_id
=
"-
#{
cls_identifier
}
-
#{
id
}
"
imageUploadUrl
=
Discussion
.
urlFor
(
'upload'
)
editor
=
Markdown
.
makeWmdEditor
elem
,
appended_id
,
imageUploadUrl
,
Discussion
.
postMathJaxProcessor
console
.
log
editor
wmdEditors
[
"
#{
cls_identifier
}
-
#{
id
}
"
]
=
editor
$input
=
$
(
"#wmd-input-
#{
cls_identifier
}
-
#{
id
}
"
)
$input
.
attr
(
"placeholder"
,
"post a new topic..."
).
bind
'focus'
,
(
e
)
->
...
...
lms/templates/discussion/_inline.html
View file @
44f7b37b
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<
%!
from
django
.
template
.
defaultfilters
import
escapejs
%
>
<section
class=
"discussion inline-discussion"
_id=
"${discussion_id}"
>
...
...
@@ -27,18 +28,11 @@
<
%
include
file=
"_paginator.html"
/>
</section>
<
%!
def
escape_quotes
(
text
)
:
return
text
.
replace
('\"',
'\\\"').
replace
("\'",
"\\\'")
%
>
<script
type=
"text/javascript"
>
var
$$user_info
=
JSON
.
parse
(
'${user_info | escape_quotes}'
);
var
$$course_id
=
"${course_id}"
;
var
$$user_info
=
JSON
.
parse
(
"${user_info | escapejs}"
);
var
$$course_id
=
"${course_id
| escapejs
}"
;
if
(
typeof
$$annotated_content_info
===
undefined
||
$$annotated_content_info
===
null
)
{
var
$$annotated_content_info
=
{};
}
$$annotated_content_info
=
$
.
extend
(
$$annotated_content_info
,
JSON
.
parse
(
"${annotated_content_info | escape
_quote
s}"
));
$$annotated_content_info
=
$
.
extend
(
$$annotated_content_info
,
JSON
.
parse
(
"${annotated_content_info | escape
j
s}"
));
</script>
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