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
2c6c64d5
Commit
2c6c64d5
authored
Sep 11, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort comment replies in chronological order, keeping the parent references.
parent
2900c169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
lms/static/coffee/src/discussion/views/response_comment_view.coffee
+4
-4
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+13
-9
No files found.
lms/static/coffee/src/discussion/views/response_comment_view.coffee
View file @
2c6c64d5
...
...
@@ -10,10 +10,10 @@ if Backbone?
render
:
->
@
template
=
_
.
template
(
$
(
"#response-comment-template"
).
html
())
params
=
@
model
.
toJSON
()
params
[
'deep'
]
=
@
options
.
deep
if
@
options
.
deep
params
[
'parent_id'
]
=
@
options
.
parent
.
id
params
[
'parent_username'
]
=
@
options
.
parent
.
get
(
'username'
)
params
[
'deep'
]
=
@
model
.
has
(
'parent'
)
if
@
model
.
has
(
'parent'
)
params
[
'parent_id'
]
=
@
model
.
get
(
'parent'
)
.
id
params
[
'parent_username'
]
=
@
model
.
get
(
'parent'
)
.
get
(
'username'
)
@
$el
.
html
(
@
template
(
params
))
@
initLocal
()
@
delegateEvents
()
...
...
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
2c6c64d5
console
.
log
(
'test 1'
)
if
Backbone
?
console
.
log
(
'test 2'
)
class
@
ThreadResponseView
extends
DiscussionContentView
tagName
:
"li"
...
...
@@ -30,16 +27,23 @@ if Backbone?
MathJax
.
Hub
.
Queue
[
"Typeset"
,
MathJax
.
Hub
,
element
[
0
]]
renderComments
:
->
@
model
.
get
(
"comments"
).
each
(
comment
)
=>
@
renderComment
(
comment
,
false
,
null
)
comments
=
new
Comments
()
comments
.
comparator
=
(
comment
)
->
comment
.
get
(
'created_at'
)
collectComments
=
(
comment
)
->
comments
.
add
(
comment
)
children
=
new
Comments
(
comment
.
get
(
'children'
))
children
.
each
(
child
)
->
child
.
set
(
'parent'
,
comment
)
collectComments
(
child
)
@
model
.
get
(
'comments'
).
each
collectComments
comments
.
each
(
comment
)
=>
@
renderComment
(
comment
,
false
,
null
)
renderComment
:
(
comment
,
deep
=
false
,
parent
=
null
)
=>
renderComment
:
(
comment
)
=>
comment
.
set
(
'thread'
,
@
model
.
get
(
'thread'
))
view
=
new
ResponseCommentView
(
model
:
comment
,
deep
:
deep
,
parent
:
parent
)
view
=
new
ResponseCommentView
(
model
:
comment
)
view
.
render
()
@
$el
.
find
(
".comments li:last"
).
before
(
view
.
el
)
children
=
new
Comments
(
comment
.
get
(
'children'
))
children
.
each
(
child
)
=>
@
renderComment
child
,
true
,
comment
toggleVote
:
(
event
)
->
event
.
preventDefault
()
...
...
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