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
a905ac9e
Commit
a905ac9e
authored
Aug 20, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated backbone & single thread retrieval now working
parent
d189a49e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
10 deletions
+74
-10
common/static/js/vendor/backbone-min.js
+0
-0
lms/djangoapps/django_comment_client/forum/views.py
+2
-0
lms/envs/dev.py
+1
-0
lms/static/coffee/src/backbone_discussion/content.coffee
+62
-6
lms/static/coffee/src/backbone_discussion/discussion.coffee
+6
-2
lms/static/coffee/src/backbone_discussion/main.coffee
+2
-1
lms/templates/discussion/_content_renderer.html
+1
-1
No files found.
common/static/js/vendor/backbone-min.js
View file @
a905ac9e
This diff is collapsed.
Click to expand it.
lms/djangoapps/django_comment_client/forum/views.py
View file @
a905ac9e
...
...
@@ -10,6 +10,7 @@ from mitxmako.shortcuts import render_to_response, render_to_string
from
courseware.courses
import
get_course_with_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
...
...
@@ -188,6 +189,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
return
utils
.
JsonResponse
({
'html'
:
html
,
'content'
:
thread
.
to_dict
(),
'annotated_content_info'
:
annotated_content_info
,
})
...
...
lms/envs/dev.py
View file @
a905ac9e
...
...
@@ -15,6 +15,7 @@ TEMPLATE_DEBUG = True
MITX_FEATURES
[
'DISABLE_START_DATES'
]
=
True
MITX_FEATURES
[
'ENABLE_SQL_TRACKING_LOGS'
]
=
True
MITX_FEATURES
[
'ENABLE_DISCUSSION_SERVICE'
]
=
True
WIKI_ENABLED
=
True
...
...
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
a905ac9e
...
...
@@ -18,12 +18,61 @@ class @Content extends Backbone.Model
can
:
(
action
)
->
DiscussionUtil
.
getContentInfo
@
id
,
action
initialize
:
->
@
set
(
'comments'
,
new
Comments
())
if
@
get
(
'children'
)
@
get
(
'comments'
).
reset
@
get
(
'children'
),
{
silent
:
false
}
class
@
ContentView
extends
Backbone
.
View
$
:
(
selector
)
->
@
$local
.
find
(
selector
)
showSingleThread
:
(
event
)
->
$threadTitle
=
@
$
(
".thread-title"
)
$showComments
=
@
$
(
".discussion-show-comments"
)
if
not
$showComments
.
hasClass
(
"first-time"
)
and
(
not
$showComments
.
length
or
not
$threadTitle
.
length
)
return
rebindHideEvents
=
->
$threadTitle
.
unbind
(
'click'
).
click
@
hideSingleThread
$showComments
.
unbind
(
'click'
).
click
@
hideSingleThread
$showComments
.
removeClass
(
"discussion-show-comments"
)
.
addClass
(
"discussion-hide-comments"
)
prevHtml
=
$showComments
.
html
()
$showComments
.
html
prevHtml
.
replace
"Show"
,
"Hide"
if
not
$showComments
.
hasClass
(
"first-time"
)
and
@
$el
.
children
(
".comments"
).
length
@
$el
.
children
(
".comments"
).
show
()
rebindHideEvents
()
else
discussion_id
=
@
model
.
discussion
.
id
url
=
DiscussionUtil
.
urlFor
(
'retrieve_single_thread'
,
discussion_id
,
@
model
.
id
)
DiscussionUtil
.
safeAjax
$elem
:
$
.
merge
(
$threadTitle
,
$showComments
)
url
:
url
type
:
"GET"
dataType
:
'json'
success
:
(
response
,
textStatus
)
=>
DiscussionUtil
.
bulkExtendContentInfo
response
[
'annotated_content_info'
]
@
$el
.
append
(
response
[
'html'
])
@
model
.
get
(
'comments'
).
reset
response
.
content
.
children
,
{
silent
:
false
}
@
initCommentViews
()
$showComments
.
removeClass
(
"first-time"
)
rebindHideEvents
()
initCommentViews
:
->
@
$el
.
children
(
".comments"
).
children
(
".comment"
).
each
(
index
,
elem
)
=>
model
=
@
model
.
get
(
'comments'
).
find
$
(
elem
).
attr
(
"_id"
)
if
not
model
.
view
commentView
=
new
CommentView
el
:
elem
,
model
:
model
hideSingleThread
:
->
reply
:
->
cancelReply
:
->
unvote
:
(
event
)
->
url
=
DiscussionUtil
.
urlFor
(
"undo_vote_for_
#{
@
model
.
get
(
'type'
)
}
"
,
@
model
.
id
)
...
...
@@ -55,12 +104,6 @@ class @ContentView extends Backbone.View
@
$
(
".discussion-vote-
#{
value
}
"
).
addClass
(
"voted"
)
@
$
(
".discussion-votes-point"
).
html
response
.
votes
.
point
hideSingleThread
:
->
reply
:
->
cancelReply
:
->
endorse
:
->
close
:
->
...
...
@@ -85,6 +128,7 @@ class @ContentView extends Backbone.View
initLocal
:
->
@
$local
=
@
$el
.
children
(
".local"
)
@
$delegateElement
=
@
$local
initFollowThread
:
->
$el
.
children
(
".discussion-content"
)
...
...
@@ -117,6 +161,7 @@ class @ContentView extends Backbone.View
@
initTimeago
()
@
initBody
()
@
initActions
()
@
initCommentViews
()
class
@
Thread
extends
@
Content
...
...
@@ -124,5 +169,16 @@ class @ThreadView extends @ContentView
class
@
Comment
extends
@
Content
class
@
CommentView
extends
@
ContentView
class
@
Comments
extends
Backbone
.
Collection
model
:
Comment
initialize
:
->
@
bind
"add"
,
(
item
)
=>
item
.
collection
=
@
find
:
(
id
)
->
_
.
first
@
where
(
id
:
id
)
lms/static/coffee/src/backbone_discussion/discussion.coffee
View file @
a905ac9e
class
@
Discussion
extends
Backbone
.
Collection
model
:
Thread
initialize
:
->
this
.
bind
"add"
,
(
item
)
=>
item
.
collection
=
this
@
bind
"add"
,
(
item
)
=>
console
.
log
item
item
.
discussion
=
@
find
:
(
id
)
->
_
.
first
@
where
(
id
:
id
)
...
...
@@ -16,9 +18,11 @@ class @DiscussionView extends Backbone.View
initLocal
:
->
@
$local
=
@
$el
.
children
(
".local"
)
@
$delegateElement
=
@
$local
initialize
:
->
@
initLocal
()
@
model
.
id
=
@
$el
.
attr
(
"_id"
)
@
model
.
view
=
@
@
$el
.
children
(
".threads"
).
children
(
".thread"
).
each
(
index
,
elem
)
=>
threadView
=
new
ThreadView
el
:
elem
,
model
:
@
model
.
find
$
(
elem
).
attr
(
"_id"
)
...
...
lms/static/coffee/src/backbone_discussion/main.coffee
View file @
a905ac9e
...
...
@@ -5,5 +5,6 @@ $ ->
$
(
"section.discussion"
).
each
(
index
,
elem
)
->
discussionData
=
DiscussionUtil
.
getDiscussionData
(
elem
)
discussion
=
new
Discussion
(
discussionData
)
discussion
=
new
Discussion
()
discussion
.
reset
(
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
elem
,
model
:
discussion
)
lms/templates/discussion/_content_renderer.html
View file @
a905ac9e
...
...
@@ -5,7 +5,7 @@
</
%
def>
<
%
def
name=
"render_content_with_comments(content)"
>
<div
class=
"${content['type']}"
_id=
"${content['id']}"
_discussion_id=
"${content.get('commentable_id')}"
_author_id=
"${helpers.show_if(content['user_id'],
content.get('anonymous'))}"
>
<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>
% if content.get('children') is not None:
${render_comments(content['children'])}
...
...
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