home button working, default to home when no thread selected
This commit is contained in:
@@ -20,6 +20,7 @@ if Backbone?
|
||||
|
||||
allThreads: ->
|
||||
@nav.updateSidebar()
|
||||
@nav.goHome()
|
||||
|
||||
setActiveThread: =>
|
||||
if @thread
|
||||
|
||||
@@ -84,6 +84,7 @@ class @DiscussionUtil
|
||||
threads : "/courses/#{$$course_id}/discussion/forum"
|
||||
"enable_notifications" : "/notification_prefs/enable/"
|
||||
"disable_notifications" : "/notification_prefs/disable/"
|
||||
"notifications_status" : "/user_api/v1/user_prefs/?key=notification_pref&use=#{param}"
|
||||
}[name]
|
||||
|
||||
@safeAjax: (params) ->
|
||||
|
||||
@@ -198,12 +198,20 @@ if Backbone?
|
||||
$(".discussion-column").html(@template)
|
||||
$(".post-list a").removeClass("active")
|
||||
$("input.email-setting").bind "click", @updateEmailNotifications
|
||||
url=DiscussionUtil.urlFor("get_notifications_state",window.user.get("id"))
|
||||
url = DiscussionUtil.urlFor("notifications_status",window.user.get("id"))
|
||||
DiscussionUtil.safeAjax
|
||||
url: url
|
||||
type: "POST"
|
||||
type: "GET"
|
||||
dataType: 'json'
|
||||
success: (response, textStatus) =>
|
||||
if response.count==1
|
||||
$('input.email-setting').attr('checked','checked')
|
||||
else
|
||||
$('input.email-setting').removeAttr('checked')
|
||||
thread_id = null
|
||||
@trigger("thread:removed")
|
||||
#select all threads
|
||||
|
||||
|
||||
toggleTopicDrop: (event) =>
|
||||
event.preventDefault()
|
||||
@@ -435,25 +443,19 @@ if Backbone?
|
||||
@retrieveFirstPage(event)
|
||||
|
||||
updateEmailNotifications: () =>
|
||||
if $('input.email-notification').attr('checked')
|
||||
if $('input.email-setting').attr('checked')
|
||||
DiscussionUtil.safeAjax
|
||||
url: DiscussionUtil.urlFor("enable_notifications")
|
||||
type: "POST"
|
||||
dataType: 'json'
|
||||
data:
|
||||
user: window.user.get("id")
|
||||
error: () =>
|
||||
$('input.email-notification').removeAttr('checked')
|
||||
$('input.email-setting').removeAttr('checked')
|
||||
|
||||
|
||||
else
|
||||
DiscussionUtil.safeAjax
|
||||
url: DiscussionUtil.urlFor("disable_notifications")
|
||||
type: "POST"
|
||||
dataType: 'json'
|
||||
data:
|
||||
user: window.user.get("id")
|
||||
error: () =>
|
||||
$('input.email-notification').attr('checked','checked')
|
||||
$('input.email-setting').attr('checked','checked')
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ def _url_for_subscription(user_id):
|
||||
|
||||
|
||||
def _url_for_user_active_threads(user_id):
|
||||
print("\n\n\n*********** ACTIVE THREADS **********\n\n\n")
|
||||
return "{prefix}/users/{user_id}/active_threads".format(prefix=settings.PREFIX, user_id=user_id)
|
||||
|
||||
|
||||
@@ -105,7 +104,6 @@ def _url_for_user_subscribed_threads(user_id):
|
||||
return "{prefix}/users/{user_id}/subscribed_threads".format(prefix=settings.PREFIX, user_id=user_id)
|
||||
|
||||
def _url_for_user_stats(user_id,course_id):
|
||||
print("\n\n\n*********** USER STATS **********\n\n\n")
|
||||
return "{prefix}/users/{user_id}/stats?course_id={course_id}".format(prefix=settings.PREFIX, user_id=user_id,course_id=course_id)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user