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
37c78524
Commit
37c78524
authored
Aug 22, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrated threads reloading related stuff
parent
4a3975c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
13 deletions
+44
-13
lms/djangoapps/django_comment_client/forum/views.py
+14
-10
lms/static/coffee/src/backbone_discussion/content.coffee
+1
-0
lms/static/coffee/src/backbone_discussion/discussion.coffee
+29
-3
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
37c78524
...
...
@@ -142,19 +142,23 @@ def forum_form_discussion(request, course_id):
threads
,
query_params
=
get_threads
(
request
,
course_id
)
content
=
render_forum_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
_general_discussion_id
(
course_id
),
query_params
=
query_params
)
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
,
)
if
request
.
is_ajax
():
return
utils
.
HtmlResponse
(
content
)
return
utils
.
JsonResponse
({
'html'
:
content
,
'discussionData'
:
threads
,
})
else
:
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
,
)
context
=
{
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'course'
:
course
,
...
...
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
37c78524
...
...
@@ -87,6 +87,7 @@ class @ContentView extends Backbone.View
@
$
(
".discussion-follow-thread"
).
removeClass
(
"discussion-unfollow-thread"
).
html
(
"Follow"
)
ability
:
(
ability
)
->
console
.
log
"triggered"
for
action
,
elemSelector
of
@
model
.
actions
if
not
ability
[
action
]
@
$
(
elemSelector
).
parent
().
remove
()
...
...
lms/static/coffee/src/backbone_discussion/discussion.coffee
View file @
37c78524
...
...
@@ -26,15 +26,41 @@ class @DiscussionView extends Backbone.View
@
model
.
view
=
@
@
$el
.
children
(
".threads"
).
children
(
".thread"
).
each
(
index
,
elem
)
=>
threadView
=
new
ThreadView
el
:
elem
,
model
:
@
model
.
find
$
(
elem
).
attr
(
"_id"
)
if
@
$el
.
hasClass
(
"forum-discussion"
)
$
(
".discussion-sidebar"
).
find
(
".sidebar-new-post-button"
)
.
unbind
(
'click'
).
click
$
.
proxy
@
newPost
,
@
else
if
@
$el
.
hasClass
(
"inline-discussion"
)
@
newPost
()
search
:
->
reload
:
(
$elem
,
url
)
->
if
not
url
then
return
DiscussionUtil
.
get
$elem
,
url
,
(
response
,
textStatus
)
=>
$discussion
=
$
(
response
.
html
)
$parent
=
@
$el
.
parent
()
@
$el
.
replaceWith
(
$discussion
)
@
model
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
el
:
$discussion
[
0
],
model
:
@
model
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
newPost
:
->
search
:
(
event
)
->
$elem
=
$
(
event
.
target
)
url
=
URI
(
$elem
.
attr
(
"action"
)).
addSearch
({
text
:
@
$
(
".search-input"
).
val
()})
@
reload
(
$elem
,
url
)
sort
:
->
$elem
=
$
(
event
.
target
)
url
=
$elem
.
attr
(
"sort-url"
)
@
reload
(
$elem
,
url
)
page
:
->
page
:
(
event
)
->
$elem
=
$
(
event
.
target
)
url
=
$elem
.
attr
(
"page-url"
)
@
reload
(
$elem
,
url
)
events
:
"submit .search-wrapper>.discussion-search-form"
:
"search"
"click .discussion-search-link"
:
"search"
"click .discussion-sort-link"
:
"sort"
"click .discussion-pag
inator>.discussion-pag
e-link"
:
"page"
"click .discussion-page-link"
:
"page"
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