From 19c41fb6be56e7f80595ee06d731493912f72362 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 29 Jun 2010 20:53:49 -0700 Subject: [PATCH] DG IZ; comments show and hide --- app/views/blogs/_blog.html.haml | 6 ++++- app/views/bookmarks/_bookmark.html.haml | 6 ++++- app/views/friends/show.html.haml | 32 ++++++++++--------------- app/views/layouts/application.html.haml | 16 ++++++++----- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 1494d89fa..34d53f226 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml @@ -6,7 +6,11 @@ %b= post.title %br = raw post.body - %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", blog_path(post) + %div.time + = link_to(how_long_ago(post), blog_path(post)) + \-- + = link_to "show comments (#{post.comments.count})", '#', :class => "show_post_comments" + = render "comments/comments", :post => post - if mine?(post) .destroy_link diff --git a/app/views/bookmarks/_bookmark.html.haml b/app/views/bookmarks/_bookmark.html.haml index 782847951..953d13b0e 100644 --- a/app/views/bookmarks/_bookmark.html.haml +++ b/app/views/bookmarks/_bookmark.html.haml @@ -7,7 +7,11 @@ %a{:href => "#{post.link}"} = post.link - %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post) + %div.time + = link_to(how_long_ago(post), bookmark_path(post)) + \-- + = link_to "show comments (#{post.comments.count})", '#', :class => "show_post_comments" + = render "comments/comments", :post => post - if mine?(post) .destroy_link diff --git a/app/views/friends/show.html.haml b/app/views/friends/show.html.haml index 444788360..5fb9572df 100644 --- a/app/views/friends/show.html.haml +++ b/app/views/friends/show.html.haml @@ -1,24 +1,16 @@ -.span-15 - .span-4.append-1.last - %img{:src => "/images/user_picture.jpg", :id => "profile_picture"} - .span-10.last - %h1= "#{@friend.real_name}" - - if @friend_profile - %p - %b First Name - %p - = @friend_profile.first_name - %p - %b Last Name - %p - = @friend_profile.last_name +.span-18.last + %h1= "#{@friend.real_name}" +- if @friend_profile + %p + %b First Name + %p + = @friend_profile.first_name + %p + %b Last Name + %p + = @friend_profile.last_name - %br - %br - %br - %br - -.span-15 +.span-18 - if @friend.posts %h3 stream %ul#stream diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 1e41860bc..ba902e426 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -62,7 +62,14 @@ $("label").inFieldLabels(); $(".show_post_comments").click( function() { - $(this).parents("li").children(".comments").fadeIn(100); + if( $(this).hasClass( "visible" )) { + $(this).html($(this).html().replace("hide", "show")); + $(this).parents("li").children(".comments").fadeOut(100); + } else { + $(this).html($(this).html().replace("show", "hide")); + $(this).parents("li").children(".comments").fadeIn(100); + } + $(this).toggleClass( "visible" ); }); @@ -95,18 +102,15 @@ = my_latest_message #content.span-24.last .span-5.append-1.last - %img{:src => "/images/user_picture.jpg", :id => "user_picture"} + = link_to (image_tag "/images/user_picture.jpg", :id => "user_picture"), root_path + %ul#stream_filters - %a{ :href => root_path, :title => "Your network stream."} - %li home %a{ :href => status_messages_path, :title => "Recent status messages."} %li status messages %a{ :href => bookmarks_path, :title => "Recently shared links."} %li bookmarks %a{ :href => blogs_path, :title => "Recent blog posts."} %li blogs - %a{ :href => friends_path, :title => "Your list of connections with other seeds."} - %li friends = render 'friends/sidebar' if user_signed_in? .span-18 = yield