Move more forum nav rendering logic to front end
The cohort selector is rendered only for a privileged user in a cohorted course, and that logic is now in an Underscore template instead of Mako.
This commit is contained in:
@@ -8,7 +8,11 @@ if Backbone?
|
||||
@discussion = options['discussion']
|
||||
@course_settings = options['course_settings']
|
||||
|
||||
@nav = new DiscussionThreadListView(collection: @discussion, el: $(".forum-nav"))
|
||||
@nav = new DiscussionThreadListView(
|
||||
collection: @discussion,
|
||||
el: $(".forum-nav"),
|
||||
courseSettings: @course_settings
|
||||
)
|
||||
@nav.on "thread:selected", @navigateToThread
|
||||
@nav.on "thread:removed", @navigateToAllThreads
|
||||
@nav.on "threads:rendered", @setActiveThread
|
||||
|
||||
@@ -13,7 +13,8 @@ if Backbone?
|
||||
"change .forum-nav-filter-main-control": "chooseFilter"
|
||||
"change .forum-nav-filter-cohort-control": "chooseCohort"
|
||||
|
||||
initialize: ->
|
||||
initialize: (options) ->
|
||||
@courseSettings = options.courseSettings
|
||||
@displayedCollection = new Discussion(@collection.models, pages: @collection.pages)
|
||||
@collection.on "change", @reloadDisplayedCollection
|
||||
@discussionIds=""
|
||||
@@ -121,7 +122,12 @@ if Backbone?
|
||||
|
||||
render: ->
|
||||
@timer = 0
|
||||
@$el.html(@template())
|
||||
@$el.html(
|
||||
@template({
|
||||
isCohorted: @courseSettings.get("is_cohorted"),
|
||||
isPrivilegedUser: DiscussionUtil.isPrivilegedUser()
|
||||
})
|
||||
)
|
||||
@$(".forum-nav-sort-control").val(@collection.sort_preference)
|
||||
|
||||
$(window).bind "load", @updateSidebar
|
||||
|
||||
Reference in New Issue
Block a user