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
aa3a4c79
Commit
aa3a4c79
authored
Sep 13, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Obey current search query and sort order when retrieving additional pages.
parent
2b1c913c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
lms/static/coffee/src/discussion/discussion.coffee
+5
-2
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+8
-5
No files found.
lms/static/coffee/src/discussion/discussion.coffee
View file @
aa3a4c79
...
...
@@ -23,10 +23,13 @@ if Backbone?
@
add
model
model
retrieveAnotherPage
:
->
retrieveAnotherPage
:
(
search_text
=
""
,
commentable_id
=
""
,
sort_key
=
""
)
->
# TODO: Obey dropdown filter (commentable_id)
@
current_page
+=
1
url
=
DiscussionUtil
.
urlFor
'threads'
data
=
{
page
:
@
current_page
}
data
=
{
page
:
@
current_page
,
text
:
search_text
}
if
sort_key
data
[
'sort_key'
]
=
sort_key
DiscussionUtil
.
safeAjax
$elem
:
@
$el
url
:
url
...
...
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
aa3a4c79
...
...
@@ -13,6 +13,7 @@ if Backbone?
initialize
:
->
@
displayedCollection
=
new
Discussion
(
@
collection
.
models
,
pages
:
@
collection
.
pages
)
@
collection
.
on
"change"
,
@
reloadDisplayedCollection
@
sortBy
=
"date"
@
collection
.
on
"reset"
,
(
discussion
)
=>
board
=
$
(
".current-board"
).
html
()
@
displayedCollection
.
current_page
=
discussion
.
current_page
...
...
@@ -116,9 +117,10 @@ if Backbone?
@
$
(
".post-list"
).
append
(
"<li class='more-pages'><a href='#'>Load more</a></li>"
)
loadMorePages
:
->
# TODO: Obey dropdown filter
@
$
(
".more-pages"
).
html
(
'<div class="loading-animation"></div>'
)
@
$
(
".more-pages"
).
addClass
(
"loading"
)
@
collection
.
retrieveAnotherPage
()
@
collection
.
retrieveAnotherPage
(
@
current_search
,
""
,
@
sortBy
)
renderThread
:
(
thread
)
=>
content
=
$
(
_
.
template
(
$
(
"#thread-list-item-template"
).
html
())(
thread
.
toJSON
()))
...
...
@@ -242,12 +244,12 @@ if Backbone?
sortThreads
:
(
event
)
->
@
$
(
".sort-bar a"
).
removeClass
(
"active"
)
$
(
event
.
target
).
addClass
(
"active"
)
sortBy
=
$
(
event
.
target
).
data
(
"sort"
)
if
sortBy
==
"date"
@
sortBy
=
$
(
event
.
target
).
data
(
"sort"
)
if
@
sortBy
==
"date"
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByDateRecentFirst
else
if
sortBy
==
"votes"
else
if
@
sortBy
==
"votes"
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByVotes
else
if
sortBy
==
"comments"
else
if
@
sortBy
==
"comments"
@
displayedCollection
.
comparator
=
@
displayedCollection
.
sortByComments
@
displayedCollection
.
sort
()
...
...
@@ -278,6 +280,7 @@ if Backbone?
callback
.
apply
@
,
[
value
]
success
:
(
response
,
textStatus
)
=>
if
textStatus
==
'success'
# TODO: Augment existing collection?
@
collection
.
reset
(
response
.
discussion_data
)
Content
.
loadContentInfos
(
response
.
content_info
)
# TODO: Perhaps reload user info so that votes can be updated.
...
...
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