-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/kevin/email notifications panel #520
Changes from 87 commits
15de412
7ddb7a6
57c513b
0936e61
714a3f1
f213113
786d8a9
c63fb7c
03d5145
73e1227
48f4769
e515857
1af4d90
b946a10
b6c4cc4
b9d97e4
d5105b7
163610d
3df08dc
46998bd
8ef258d
38d8863
23f1942
5240342
b870679
d648b18
74ea364
9fe6264
07e87a5
b83d5aa
98cd032
0f84a52
770bfdc
05a7d66
a24c3a9
84d505e
f94ec6c
fbd0f1b
6e2de9d
63b2b47
17f4579
8886b59
8216bb6
0812867
1fe54ba
6657ac1
f674e61
b55b34f
a0f54aa
ff9f571
d2fae78
1a267a5
90e60c1
e277946
642b649
0e0ceb4
9c45293
8d49007
38e040a
2c9e4ca
37c9de7
e2f02cd
e87d071
a9ea00a
78ffc12
d8498bf
646ff9e
9eca557
3495ceb
83b4dc6
747102c
5b3cb53
820544c
77a23a3
5d106ee
d95693e
6276997
13ca61b
7507921
4afa548
b7d6d77
33d4ae6
06eb5cd
47dbf2e
62f6e2d
99f235e
0207255
8f98a1c
79994b5
803b92f
986a2cd
908fd46
5c91edd
c3e609f
4f7edbf
e1e591f
7a7c070
05f31f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ if Backbone? | |
class @DiscussionThreadListView extends Backbone.View | ||
events: | ||
"click .search": "showSearch" | ||
"click .home": "goHome" | ||
"click .browse": "toggleTopicDrop" | ||
"keydown .post-search-field": "performSearch" | ||
"click .sort-bar a": "sortThreads" | ||
|
@@ -43,6 +44,7 @@ if Backbone? | |
if active | ||
@setActiveThread(thread_id) | ||
|
||
|
||
#TODO fix this entire chain of events | ||
addAndSelectThread: (thread) => | ||
commentable_id = thread.get("commentable_id") | ||
|
@@ -191,6 +193,26 @@ if Backbone? | |
@$(".browse").removeClass('is-open') | ||
setTimeout (-> @$(".post-search-field").focus()), 200 | ||
|
||
goHome: -> | ||
@template = _.template($("#discussion-home").html()) | ||
$(".discussion-column").html(@template) | ||
$(".post-list a").removeClass("active") | ||
$("input.email-setting").bind "click", @updateEmailNotifications | ||
url = DiscussionUtil.urlFor("notifications_status",window.user.get("id")) | ||
DiscussionUtil.safeAjax | ||
url: url | ||
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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does thread:removed do something related to the home button? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it loads all threads with none selected. if the user clicks a thread, then clicks home, then hits refresh, we don't want to reload the previous selected thread, this accomplishes that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it |
||
#select all threads | ||
|
||
|
||
toggleTopicDrop: (event) => | ||
event.preventDefault() | ||
event.stopPropagation() | ||
|
@@ -312,6 +334,7 @@ if Backbone? | |
if callback? | ||
callback() | ||
|
||
|
||
retrieveDiscussions: (discussion_ids) -> | ||
@discussionIds = discussion_ids.join(',') | ||
@mode = 'commentables' | ||
|
@@ -418,3 +441,19 @@ if Backbone? | |
retrieveFollowed: (event)=> | ||
@mode = 'followed' | ||
@retrieveFirstPage(event) | ||
|
||
updateEmailNotifications: () => | ||
if $('input.email-setting').attr('checked') | ||
DiscussionUtil.safeAjax | ||
url: DiscussionUtil.urlFor("enable_notifications") | ||
type: "POST" | ||
error: () => | ||
$('input.email-setting').removeAttr('checked') | ||
else | ||
DiscussionUtil.safeAjax | ||
url: DiscussionUtil.urlFor("disable_notifications") | ||
type: "POST" | ||
error: () => | ||
$('input.email-setting').attr('checked','checked') | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
url(r'users/(?P<user_id>\w+)/followed$', 'followed_threads', name='followed_threads'), | ||
url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'), | ||
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'), | ||
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate line? |
||
url(r'^(?P<discussion_id>[\w\-.]+)/inline$', 'inline_discussion', name='inline_discussion'), | ||
url(r'', 'forum_form_discussion', name='forum_form_discussion'), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think use= param is a typo, but i also think you don't need it, since this is ajax and the user comes from auth. (the operation is working for me in manual tests)