every post partial shows a user picture. a post's comments are displayed with a count in its show page

This commit is contained in:
danielvincent 2010-07-17 13:41:54 -07:00
parent 31629f8115
commit b221e19746
9 changed files with 34 additions and 5 deletions

View file

@ -7,6 +7,7 @@ class PhotosController < ApplicationController
def create def create
@photo = Photo.new(params[:photo]) @photo = Photo.new(params[:photo])
@photo.person = current_user
if @photo.save if @photo.save
flash[:notice] = "Successfully uploaded photo." flash[:notice] = "Successfully uploaded photo."

View file

@ -44,8 +44,8 @@ class Post
end end
#ENCRYPTION #ENCRYPTION
before_validation :sign_if_mine #before_validation :sign_if_mine
validates_true_for :creator_signature, :logic => lambda {self.verify_creator_signature} #validates_true_for :creator_signature, :logic => lambda {self.verify_creator_signature}
xml_accessor :creator_signature xml_accessor :creator_signature
key :creator_signature, String key :creator_signature, String

View file

@ -1,4 +1,7 @@
%li.message{:id => post.id, :class => ("mine" if mine?(post))} %li.message{:id => post.id, :class => ("mine" if mine?(post))}
= person_image_tag(post.person)
%span.from %span.from
= link_to_person post.person = link_to_person post.person
%b wrote a new blog post %b wrote a new blog post

View file

@ -10,6 +10,9 @@
%strong Owner: %strong Owner:
= @blog.person.real_name = @blog.person.real_name
%h4= "comments (#{@blog.comments.count})"
= render "comments/comments", :post => @blog
%p %p
= link_to "Edit", edit_blog_path(@blog) = link_to "Edit", edit_blog_path(@blog)
| |

View file

@ -1,4 +1,7 @@
%li.message{:id => post.id, :class => ("mine" if mine?(post))} %li.message{:id => post.id, :class => ("mine" if mine?(post))}
= person_image_tag(post.person)
%span.from %span.from
= link_to_person post.person = link_to_person post.person
%b shared a link %b shared a link

View file

@ -10,6 +10,9 @@
%strong Owner: %strong Owner:
= @bookmark.person.real_name = @bookmark.person.real_name
%h4= "comments (#{@bookmark.comments.count})"
= render "comments/comments", :post => @bookmark
%p %p
= link_to "Edit", edit_bookmark_path(@bookmark) = link_to "Edit", edit_bookmark_path(@bookmark)
| |

View file

@ -1,3 +1,15 @@
%li.message{:id => post.id} %li.message{:id => post.id}
= person_image_tag(post.person)
%span.from
= link_to_person post.person
%b posted a new photo
%br
= link_to (image_tag post.image.url(:small_thumb)), photo_path(post) = link_to (image_tag post.image.url(:small_thumb)), photo_path(post)
%div.time
= link_to(how_long_ago(post), status_message_path(post))
\--
= link_to "show comments (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post

View file

@ -1,9 +1,10 @@
- title "Photo" - title "Photo"
%p
%strong Photo:
= image_tag @photo.image.url = image_tag @photo.image.url
%h4= "comments (#{@photo.comments.count})"
= render "comments/comments", :post => @photo
%p %p
= link_to "Destroy", @photo, :confirm => 'Are you sure?', :method => :delete = link_to "Destroy", @photo, :confirm => 'Are you sure?', :method => :delete
| |

View file

@ -8,6 +8,9 @@
%strong Owner: %strong Owner:
= @status_message.person.real_name = @status_message.person.real_name
%h4= "comments (#{@status_message.comments.count})"
= render "comments/comments", :post => @status_message
%p %p
= link_to "Destroy", @status_message, :confirm => 'Are you sure?', :method => :delete = link_to "Destroy", @status_message, :confirm => 'Are you sure?', :method => :delete
| |