Commit e809fb3b by Ibrahim Awwal

Use loadMorePages to load All as well.

parent 74ba9319
...@@ -53,6 +53,7 @@ if Backbone? ...@@ -53,6 +53,7 @@ if Backbone?
Content.loadContentInfos(response.annotated_content_info) Content.loadContentInfos(response.annotated_content_info)
@reset new_collection @reset new_collection
@pages = response.num_pages @pages = response.num_pages
@current_page = response.page
sortByDate: (thread) -> sortByDate: (thread) ->
thread.get("created_at") thread.get("created_at")
......
...@@ -298,17 +298,10 @@ if Backbone? ...@@ -298,17 +298,10 @@ if Backbone?
# @displayedCollection.reset(@collection.models) # @displayedCollection.reset(@collection.models)
retrieveAllThreads: () -> retrieveAllThreads: () ->
@mode='all' @mode = 'all'
url = DiscussionUtil.urlFor("threads") @collection.current_page = 0
DiscussionUtil.safeAjax @collection.reset()
url: url @loadMorePages()
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) #Don't think this is necessary
sortThreads: (event) -> sortThreads: (event) ->
@$(".sort-bar a").removeClass("active") @$(".sort-bar a").removeClass("active")
...@@ -321,7 +314,7 @@ if Backbone? ...@@ -321,7 +314,7 @@ if Backbone?
when 'votes' then @displayedCollection.sortByVotes when 'votes' then @displayedCollection.sortByVotes
when 'comments' then @displayedCollection.sortByComments when 'comments' then @displayedCollection.sortByComments
@loadMorePages(event) @loadMorePages(event)
#@displayedCollection.sort() # This should be called automatically and calling this makes the loading indicator go away #@displayedCollection.sort() # This should be called automatically and calling manually makes the loading indicator go away
performSearch: (event) -> performSearch: (event) ->
if event.which == 13 if event.which == 13
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment