clicking on notifications takes note of the current UI state and makes sure that the resulting 'read' state matches the users expectation.

This commit is contained in:
Steven Fuchs 2011-12-22 15:56:03 -05:00
parent a7af886da2
commit b6dd14a968

View file

@ -15,11 +15,18 @@
notificationArea: notificationArea
});
$(".stream_element.unread").live("mousedown", function() {
self.decrementCount();
$(".stream_element.unread,.stream_element.read").live("mousedown", function() {
if ( $(this).hasClass("unread") ) {
self.decrementCount();
$(this).removeClass("unread").addClass( "read" )
}
else {
self.incrementCount();
$(this).removeClass("read").addClass( "unread" )
}
$.ajax({
url: "notifications/" + $(this).removeClass("unread").data("guid"),
url: "notifications/" + $(this).data("guid"),
data: { is_unread: $(this).hasClass("unread") },
type: "PUT"
});
});