Commit 47dbf2e6 by Your Name

updates but getting status and setting status not working

parent 06eb5cdd
...@@ -82,6 +82,8 @@ class @DiscussionUtil ...@@ -82,6 +82,8 @@ class @DiscussionUtil
user_profile : "/courses/#{$$course_id}/discussion/forum/users/#{param}" user_profile : "/courses/#{$$course_id}/discussion/forum/users/#{param}"
followed_threads : "/courses/#{$$course_id}/discussion/forum/users/#{param}/followed" followed_threads : "/courses/#{$$course_id}/discussion/forum/users/#{param}/followed"
threads : "/courses/#{$$course_id}/discussion/forum" threads : "/courses/#{$$course_id}/discussion/forum"
"enable_notifications" : "/notification_prefs/enable/"
"disable_notifications" : "/notification_prefs/disable/"
}[name] }[name]
@safeAjax: (params) -> @safeAjax: (params) ->
......
...@@ -197,7 +197,12 @@ if Backbone? ...@@ -197,7 +197,12 @@ if Backbone?
@template = _.template($("#discussion-home").html()) @template = _.template($("#discussion-home").html())
$(".discussion-column").html(@template) $(".discussion-column").html(@template)
$(".post-list a").removeClass("active") $(".post-list a").removeClass("active")
$(".email-notification").bind "click", @updateEmailNotifications $("input.email-setting").bind "click", @updateEmailNotifications
url=DiscussionUtil.urlFor("get_notifications_state",window.user.get("id"))
DiscussionUtil.safeAjax
url: url
type: "POST"
dataType: 'json'
thread_id = null thread_id = null
toggleTopicDrop: (event) => toggleTopicDrop: (event) =>
...@@ -432,20 +437,23 @@ if Backbone? ...@@ -432,20 +437,23 @@ if Backbone?
updateEmailNotifications: () => updateEmailNotifications: () =>
if $('input.email-notification').attr('checked') if $('input.email-notification').attr('checked')
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
url: '/notification_prefs/enable/' url: DiscussionUtil.urlFor("enable_notifications")
type: "POST" type: "POST"
dataType: 'json' dataType: 'json'
data: data:
username: window.user.get("username") user: window.user.get("id")
error: () => error: () =>
$('input.email-notification').removeAttr('checked')
else else
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
url: '/notification_prefs/disable/' url: DiscussionUtil.urlFor("disable_notifications")
type: "POST" type: "POST"
dataType: 'json' dataType: 'json'
data: data:
username: window.user.get("username") user: window.user.get("id")
error: () => error: () =>
$('input.email-notification').attr('checked','checked')
...@@ -131,7 +131,6 @@ def ajax_disable(request): ...@@ -131,7 +131,6 @@ def ajax_disable(request):
return HttpResponse(status=204) return HttpResponse(status=204)
@require_GET @require_GET
def unsubscribe(request, token): def unsubscribe(request, token):
""" """
......
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