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
ece2ea85
Commit
ece2ea85
authored
Aug 20, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some progress
parent
55a6bcec
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
14 deletions
+60
-14
lms/djangoapps/django_comment_client/forum/views.py
+3
-3
lms/djangoapps/django_comment_client/middleware.py
+1
-0
lms/lib/comment_client/models.py
+3
-0
lms/static/coffee/src/backbone_discussion/content.coffee
+43
-3
lms/templates/discussion/_content.mustache
+1
-1
lms/templates/discussion/_content_renderer.html
+1
-1
lms/templates/discussion/_forum.html
+2
-2
lms/templates/discussion/_inline.html
+1
-1
lms/templates/discussion/_paginator.html
+1
-1
lms/templates/discussion/_single_thread.html
+3
-1
lms/templates/discussion/_sort.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
ece2ea85
...
...
@@ -164,9 +164,9 @@ def forum_form_discussion(request, course_id):
def
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
):
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
.
to_dict
()
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
=
thread
.
to_dict
()
,
user
=
request
.
user
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
=
thread
,
user
=
request
.
user
)
context
=
{
'discussion_id'
:
discussion_id
,
...
...
@@ -175,6 +175,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'course_id'
:
course_id
,
'request'
:
request
,
'discussion_data'
:
json
.
dumps
({
discussion_id
:
[
thread
]
}),
}
return
render_to_string
(
'discussion/_single_thread.html'
,
context
)
...
...
@@ -201,7 +202,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'content'
:
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
'course'
:
course
,
'course_id'
:
course
.
id
,
}
...
...
lms/djangoapps/django_comment_client/middleware.py
View file @
ece2ea85
...
...
@@ -4,6 +4,7 @@ import json
class
AjaxExceptionMiddleware
(
object
):
def
process_exception
(
self
,
request
,
exception
):
import
pdb
;
pdb
.
set_trace
()
if
isinstance
(
exception
,
CommentClientError
)
and
request
.
is_ajax
():
return
JsonError
(
json
.
loads
(
exception
.
message
))
return
None
lms/lib/comment_client/models.py
View file @
ece2ea85
...
...
@@ -43,6 +43,9 @@ class Model(object):
raise
KeyError
(
"Field {0} does not exist"
.
format
(
key
))
self
.
attributes
.
__setitem__
(
key
,
value
)
def
items
(
self
,
*
args
,
**
kwargs
):
return
self
.
attributes
.
items
(
*
args
,
**
kwargs
)
def
get
(
self
,
*
args
,
**
kwargs
):
return
self
.
attributes
.
get
(
*
args
,
**
kwargs
)
...
...
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
ece2ea85
...
...
@@ -29,6 +29,32 @@ class @ContentView extends Backbone.View
@
$local
.
find
(
selector
)
showSingleThread
:
(
event
)
->
if
@
showed
@
$el
.
children
(
".comments"
).
hide
()
@
showed
=
false
$showComments
=
@
$
(
".discussion-show-comments"
)
prevHtml
=
$showComments
.
html
()
$showComments
.
html
prevHtml
.
replace
"Hide"
,
"Show"
else
if
@
retrieved
@
$el
.
children
(
".comments"
).
show
()
@
showed
=
true
else
discussion_id
=
@
model
.
discussion
.
id
url
=
DiscussionUtil
.
urlFor
(
'retrieve_single_thread'
,
discussion_id
,
@
model
.
id
)
DiscussionUtil
.
safeAjax
$elem
:
$
.
merge
@
$
(
".thread-title"
),
@
$
(
".discussion-show-comments"
)
url
:
url
type
:
"GET"
dataType
:
'json'
success
:
(
response
,
textStatus
)
=>
DiscussionUtil
.
bulkExtendContentInfo
response
[
'annotated_content_info'
]
@
retrieved
=
true
@
showed
=
true
@
$el
.
append
(
response
[
'html'
])
@
model
.
get
(
'comments'
).
reset
response
.
content
.
children
,
{
silent
:
false
}
@
initCommentViews
()
return
$threadTitle
=
@
$
(
".thread-title"
)
$showComments
=
@
$
(
".discussion-show-comments"
)
...
...
@@ -133,15 +159,15 @@ class @ContentView extends Backbone.View
@
$
(
".discussion-votes-point"
).
html
response
.
votes
.
point
endorse
:
(
event
)
->
url
=
DiscussionUtil
.
urlFor
(
'endorse_comment'
,
id
)
endorsed
=
not
@
model
.
get
(
'endorsed'
)
url
=
DiscussionUtil
.
urlFor
(
'endorse_comment'
,
@
model
.
id
)
endorsed
=
not
@
$el
.
hasClass
(
"endorsed"
)
Discussion
.
safeAjax
$elem
:
$
(
event
.
target
)
url
:
url
type
:
"POST"
dataType
:
"json"
data
:
{
endorsed
:
endorsed
}
success
:
(
response
,
textStatus
)
-
>
success
:
(
response
,
textStatus
)
=
>
if
textStatus
==
"success"
if
endorsed
@
$el
.
addClass
(
"endorsed"
)
...
...
@@ -211,6 +237,7 @@ class @ContentView extends Backbone.View
Discussion
.
extendContentInfo
response
.
content
[
'id'
],
response
[
'annotated_content_info'
]
Discussion
.
initializeContent
(
$content
)
Discussion
.
bindContentEvents
(
$content
)
delete
:
->
if
$content
.
hasClass
(
"thread"
)
url
=
Discussion
.
urlFor
(
'delete_thread'
,
id
)
...
...
@@ -274,12 +301,25 @@ class @ContentView extends Backbone.View
initTimeago
:
->
@
$
(
"span.timeago"
).
timeago
()
initPermalink
:
->
if
@
model
.
get
(
'type'
)
==
'thread'
discussion_id
=
@
model
.
get
(
'commentable_id'
)
permalink
=
Discussion
.
urlFor
(
"permanent_link_thread"
,
discussion_id
,
@
model
.
id
)
else
thread_id
=
@
model
.
get
(
'thread_id'
)
discussion_id
=
@
$el
.
parents
(
".thread"
).
attr
(
"_discussion_id"
)
permalink
=
Discussion
.
urlFor
(
"permanent_link_comment"
,
discussion_id
,
thread_id
,
@
model
.
id
)
@
$
(
".discussion-permanent-link"
).
attr
"href"
,
permalink
initialize
:
->
@
model
.
view
=
@
@
initLocal
()
@
initVote
()
@
initTimeago
()
@
initBody
()
@
initPermalink
()
@
initActions
()
@
initCommentViews
()
...
...
lms/templates/discussion/_content.mustache
View file @
ece2ea85
<div
class=
"discussion-content"
>
<div
class=
"discussion-content
local
"
>
<div
class=
"discussion-content-wrapper"
>
<div
class=
"discussion-votes"
>
<a
class=
"discussion-vote discussion-vote-up"
href=
"javascript:void(0)"
value=
"up"
>
▲
</a>
...
...
lms/templates/discussion/_content_renderer.html
View file @
ece2ea85
...
...
@@ -6,7 +6,7 @@
<
%
def
name=
"render_content_with_comments(content)"
>
<div
class=
"${content['type']}${helpers.show_if(' endorsed', content.get('endorsed'))}"
_id=
"${content['id']}"
_discussion_id=
"${content.get('commentable_id', '')}"
_author_id=
"${helpers.show_if(content['user_id'], not content.get('anonymous'))}"
>
<div
class=
"local"
>
${render_content(content)}
</div>
${render_content(content)}
% if content.get('children') is not None:
${render_comments(content['children'])}
% endif
...
...
lms/templates/discussion/_forum.html
View file @
ece2ea85
...
...
@@ -13,13 +13,13 @@
</div>
<div
class=
"threads"
></div>
% else:
<
div
class=
"local"
><
%
include
file=
"_sort.html"
/></div
>
<
%
include
file=
"_sort.html"
/
>
<div
class=
"threads"
>
% for thread in threads:
${renderer.render_content_with_comments(thread)}
% endfor
</div>
<
div
class=
"local"
><
%
include
file=
"_paginator.html"
/></div
>
<
%
include
file=
"_paginator.html"
/
>
% endif
</section>
...
...
lms/templates/discussion/_inline.html
View file @
ece2ea85
...
...
@@ -10,7 +10,7 @@
% endfor
</div>
<
div
class=
"local"
><
%
include
file=
"_paginator.html"
/></div
>
<
%
include
file=
"_paginator.html"
/
>
</section>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/_paginator.html
View file @
ece2ea85
...
...
@@ -36,7 +36,7 @@
% endfor
</
%
def>
<div
class=
"discussion-${discussion_type}-paginator discussion-paginator"
>
<div
class=
"discussion-${discussion_type}-paginator discussion-paginator
local
"
>
<div
class=
"prev-page"
>
% if page > 1:
${link_to_page(page - 1, "
<
Previous page")}
...
...
lms/templates/discussion/_single_thread.html
View file @
ece2ea85
...
...
@@ -2,7 +2,9 @@
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
${renderer.render_content_with_comments(thread)}
<div
class=
"threads"
>
${renderer.render_content_with_comments(thread)}
</div>
</section>
<
%
include
file=
"_js_data.html"
/>
lms/templates/discussion/_sort.html
View file @
ece2ea85
...
...
@@ -29,7 +29,7 @@
<a
class=
"discussion-sort-link ${cls}"
href=
"javascript:void(0)"
sort-url=
"${url_for_sort(key, order)}"
>
${title}
</a>
</
%
def>
<div
class=
"discussion-sort
discussion-
local"
>
<div
class=
"discussion-sort local"
>
<span
class=
"discussion-label"
>
Sort by:
</span>
${link_to_sort('activity', 'top')}
...
...
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