Use loadMorePages to load All as well.

This commit is contained in:
Ibrahim Awwal
2012-09-19 07:02:24 -07:00
parent 74ba9319e3
commit e809fb3b64
2 changed files with 6 additions and 12 deletions

View File

@@ -53,6 +53,7 @@ if Backbone?
Content.loadContentInfos(response.annotated_content_info)
@reset new_collection
@pages = response.num_pages
@current_page = response.page
sortByDate: (thread) ->
thread.get("created_at")

View File

@@ -298,17 +298,10 @@ if Backbone?
# @displayedCollection.reset(@collection.models)
retrieveAllThreads: () ->
@mode='all'
url = DiscussionUtil.urlFor("threads")
DiscussionUtil.safeAjax
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) #Don't think this is necessary
@mode = 'all'
@collection.current_page = 0
@collection.reset()
@loadMorePages()
sortThreads: (event) ->
@$(".sort-bar a").removeClass("active")
@@ -321,7 +314,7 @@ if Backbone?
when 'votes' then @displayedCollection.sortByVotes
when 'comments' then @displayedCollection.sortByComments
@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) ->
if event.which == 13