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
2b5e93a0
Commit
2b5e93a0
authored
Sep 18, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clicking on commentables in the dropdown.
parent
18354673
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
lms/static/coffee/src/discussion/discussion.coffee
+3
-2
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+25
-18
No files found.
lms/static/coffee/src/discussion/discussion.coffee
View file @
2b5e93a0
...
...
@@ -32,8 +32,9 @@ if Backbone?
when
'search'
url
=
DiscussionUtil
.
urlFor
'search'
data
[
'text'
]
=
options
.
search_text
if
options
.
commentable_ids
data
[
'commentable_ids'
]
=
options
.
commentable_ids
when
'commentables'
url
=
DiscussionUtil
.
urlFor
'search'
data
[
'commentable_ids'
]
=
options
.
commentable_ids
when
'all'
url
=
DiscussionUtil
.
urlFor
'threads'
when
'followed'
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
2b5e93a0
...
...
@@ -120,16 +120,18 @@ if Backbone?
@
$
(
".post-list"
).
append
(
"<li class='more-pages'><a href='#'>Load more</a></li>"
)
loadMorePages
:
(
event
)
->
event
.
preventDefault
()
if
event
event
.
preventDefault
()
@
$
(
".more-pages"
).
html
(
'<div class="loading-animation"></div>'
)
@
$
(
".more-pages"
).
addClass
(
"loading"
)
options
=
{}
switch
@
mode
when
'search'
options
.
search_text
=
@
current_search
options
.
commentable_ids
=
@
discussionIds
when
'followed'
options
.
user_id
=
window
.
user
.
id
when
'commentables'
options
.
commentable_ids
=
@
discussionIds
@
collection
.
retrieveAnotherPage
(
@
mode
,
options
,
{
sort_key
:
@
sortBy
})
renderThread
:
(
thread
)
=>
...
...
@@ -273,25 +275,30 @@ if Backbone?
@
collection
.
pages
=
response
.
num_pages
@
collection
.
reset
(
response
.
discussion_data
)
Content
.
loadContentInfos
(
response
.
annotated_content_info
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
# Don't think this is necessary because it's called on collection.reset
if
callback
?
callback
()
retrieveDiscussions
:
(
discussion_ids
)
->
@
discussionIds
=
discussion_ids
.
join
(
','
)
url
=
DiscussionUtil
.
urlFor
(
"search"
)
DiscussionUtil
.
safeAjax
data
:
{
'commentable_ids'
:
@
discussionIds
}
url
:
url
type
:
"GET"
success
:
(
response
,
textStatus
)
=>
@
collection
.
current_page
=
response
.
page
@
collection
.
pages
=
response
.
num_pages
@
collection
.
reset
(
response
.
discussion_data
)
Content
.
loadContentInfos
(
response
.
annotated_content_info
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
@
mode
=
'commentables'
@
collection
.
current_page
=
0
@
collection
.
reset
()
@
loadMorePages
()
# url = DiscussionUtil.urlFor("search")
# DiscussionUtil.safeAjax
# data: { 'commentable_ids': @discussionIds }
# url: url
# type: "GET"
# success: (response, textStatus) =>
# @collection.current_page = response.page
# @collection.pages = response.num_pages
# @collection.reset(response.discussion_data)
# Content.loadContentInfos(response.annotated_content_info)
# @displayedCollection.reset(@collection.models)
retrieveAllThreads
:
()
->
@
mode
=
'all'
url
=
DiscussionUtil
.
urlFor
(
"threads"
)
DiscussionUtil
.
safeAjax
url
:
url
...
...
@@ -301,7 +308,7 @@ if Backbone?
@
collection
.
pages
=
response
.
num_pages
@
collection
.
reset
(
response
.
discussion_data
)
Content
.
loadContentInfos
(
response
.
annotated_content_info
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
#Don't think this is necessary
sortThreads
:
(
event
)
->
@
$
(
".sort-bar a"
).
removeClass
(
"active"
)
...
...
@@ -309,12 +316,12 @@ if Backbone?
@
sortBy
=
$
(
event
.
target
).
data
(
"sort"
)
@
collection
.
reset
()
@
collection
.
current_page
=
0
@
loadMorePages
(
event
)
@
displayedCollection
.
comparator
=
switch
@
sortBy
when
'date'
then
@
displayedCollection
.
sortByDateRecentFirst
when
'votes'
then
@
displayedCollection
.
sortByVotes
when
'comments'
then
@
displayedCollection
.
sortByComments
@
displayedCollection
.
sort
()
@
loadMorePages
(
event
)
#@displayedCollection.sort() # This should be called automatically and calling this makes the loading indicator go away
performSearch
:
(
event
)
->
if
event
.
which
==
13
...
...
@@ -355,7 +362,7 @@ if Backbone?
# TODO: Perhaps reload user info so that votes can be updated.
# In the future we might not load all of a user's votes at once
# so this would probably be necessary anyway
@
displayedCollection
.
reset
(
@
collection
.
models
)
@
displayedCollection
.
reset
(
@
collection
.
models
)
# Don't think this is necessary
clearSearch
:
(
callback
,
value
)
->
@
$
(
".post-search-field"
).
val
(
""
)
...
...
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