Merge pull request #1169 from edx/gprice/forum-load-more-focus

Improvements in forums nav sidebar
This commit is contained in:
Greg Price
2013-09-27 14:13:00 -07:00

View File

@@ -95,6 +95,7 @@ if Backbone?
@timer = 0
@$el.html(@template())
$(window).bind "load", @updateSidebar
$(window).bind "scroll", @updateSidebar
$(window).bind "resize", @updateSidebar
@@ -143,6 +144,18 @@ if Backbone?
options.group_id = @group_id
lastThread = @collection.last()?.get('id')
if lastThread
# Pagination; focus the first thread after what was previously the last thread
@once("threads:rendered", ->
$(".post-list li:has(a[data-id='#{lastThread}']) + li a").focus()
)
else
# Totally refreshing the list (e.g. from clicking a sort button); focus the first thread
@once("threads:rendered", ->
$(".post-list a").first()?.focus()
)
@collection.retrieveAnotherPage(@mode, options, {sort_key: @sortBy})
renderThread: (thread) =>