From 1212b347065afa95a7ee7dc8590417539aeb7920 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Wed, 15 Dec 2010 11:58:13 -0800 Subject: [PATCH] fadeOut on delete --- app/controllers/status_messages_controller.rb | 4 ++-- public/javascripts/stream.js | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 84a1f3381..923b73575 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -65,11 +65,11 @@ class StatusMessagesController < ApplicationController @status_message = current_user.my_posts.where(:_id => params[:id]).first if @status_message @status_message.destroy + render :nothing => true, :status => 200 else Rails.logger.info "event=post_destroy status=failure user=#{current_user.diaspora_handle} reason='User does not own post'" + render :nothing => true, :status => 404 end - - respond_with :location => root_url end def show diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 2879064b9..8d0aa62a7 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -109,6 +109,11 @@ var Stream = { $(".new_comment").live('ajax:failure', function(data, html, xhr) { alert('failed to post message!'); }); + + $(".delete").live('ajax:success', function(data, html, xhr) { + $(this).parents(".message").fadeOut(150); + }); + }, toggleComments: function(evt) {