Make notifications/read_all non-ajax, link back to index page

This commit is contained in:
Raphael 2011-01-31 12:12:06 -08:00
parent a2bb8515f9
commit 906de27922
2 changed files with 2 additions and 12 deletions

View file

@ -26,6 +26,6 @@ class NotificationsController < ApplicationController
def read_all
Notification.where(:recipient_id => current_user.id).update_all(:unread => false)
redirect_to :back
redirect_to aspects_path
end
end

View file

@ -1,14 +1,4 @@
:javascript
$('.mark_all_read').live('click', function(){
$.ajax({
url: 'notifications/read_all',
success: function(data, status, xhr) {
$('.stream_element').removeClass('unread');
$("#notification_badge_number").addClass("hidden");
}
});
});
$('.stream_element').live('mousedown', function(evt){
var note = $(this).closest('.stream_element'),
note_id = note.attr('data-guid'),
@ -37,7 +27,7 @@
%h2
= t('.notifications')
.span-13.last.left
= link_to t('.mark_all_as_read'), "#", :class => "button mark_all_read"
= link_to t('.mark_all_as_read'), notifications_read_all_path, :class => 'button'
.span-24.last
%ul.stream.notifications