From 750b4b43886d9b818f7b72411e6a054023894410 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 14 Oct 2010 15:40:34 -0700 Subject: [PATCH] empty message re-appears if all stream posts are deleted --- app/views/aspects/index.html.haml | 7 +++---- app/views/aspects/show.html.haml | 7 +++---- app/views/js/_websocket_js.haml | 11 ++++++----- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 25ba89081..23b1763e9 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -12,10 +12,9 @@ - for post in @posts = render type_partial(post), :post => post unless post.class == Album -- if @posts.size == 0 - #empty_message - .null_arrow ⇧ - %h3 Nobody has said anything yet. Get the conversation started! +#empty_message{:style => ("display:none" unless @posts.count == 0)} + .null_arrow ⇧ + %h3 Nobody has said anything yet. Get the conversation started! #pagination = will_paginate @posts diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index 441508e8f..4e112155c 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -12,10 +12,9 @@ - for post in @posts = render type_partial(post), :post => post unless post.class == Album -- if @posts.size == 0 - #empty_message - .null_arrow ⇧ - %h3 Nobody has said anything yet. Get the conversation started! +#empty_message{:style => ("display:none" unless @posts.count == 0)} + .null_arrow ⇧ + %h3 Nobody has said anything yet. Get the conversation started! #pagination = will_paginate @posts diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml index 27f7942e0..addd0b053 100644 --- a/app/views/js/_websocket_js.haml +++ b/app/views/js/_websocket_js.haml @@ -37,9 +37,10 @@ }); function processRetraction(post_id){ - $('#' + post_id ).fadeOut(500, function(){ - $(this).remove; - }); + $('#' + post_id ).fadeOut(500).remove(); + if($("#stream")[0].childElementCount == 0){ + $("#empty_message").fadeIn(200); + } } function processComment(post_id, html){ @@ -67,8 +68,8 @@ ) }; - if( $("#empty_message").length > 0 ){ - $("#empty_message").fadeOut(400, addPostToStream(html)).remove(); + if( $("#empty_message").is(":visible") ){ + $("#empty_message").fadeOut(400, addPostToStream(html)).hide(); } else { addPostToStream(html); }