Use _stream_element.haml as a wrapper for posts in the stream.

This commit is contained in:
danielvincent 2010-11-05 17:40:28 -07:00
parent 9a055b6cba
commit 1a481d43d2
8 changed files with 43 additions and 74 deletions

View file

@ -13,6 +13,7 @@ module SocketsHelper
begin
user = User.find_by_id uid
v = render_to_string(:partial => type_partial(object), :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction
v = render_to_string(:partial => 'shared/stream_element', :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction
rescue Exception => e
Rails.logger.error("web socket view rendering failed for object #{object.inspect}.")
raise e

View file

@ -11,7 +11,7 @@
= render 'aspects/no_posts_message'
%ul#stream
- for post in @posts
= render type_partial(post), :post => post
= render 'shared/stream_element', :post => post
#pagination
= will_paginate @posts

View file

@ -11,7 +11,7 @@
= render 'aspects/no_posts_message'
%ul#stream
- for post in @posts
= render type_partial(post), :post => post
= render 'shared/stream_element', :post => post
#pagination
= will_paginate @posts

View file

@ -2,36 +2,9 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}}
= link_to (image_tag post.url(:thumb_large)), object_path(post), :class => 'stream_photo'
= person_image_link(post.person)
.content
.from
= link_to post.person.real_name, post.person
.aspect
%ul
- if post.public?
%li= t('.the_world')
- else
- for aspect in current_user.aspects_with_post( post.id )
%li= link_to aspect.name, aspect
- if current_user.owns?(post)
.right
= link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= link_to (image_tag post.url(:thumb_large)), object_path(post), :class => 'stream_photo'
%p.photo_description
= post.caption
= link_to "view all of #{post.person.real_name}'s photos", person_photos_path(post.person), :class => "small_text"
.info
%span.time= link_to(how_long_ago(post), photo_path(post))
= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post
%p.photo_description
= post.caption
= link_to "view all of #{post.person.real_name}'s photos", person_photos_path(post.person), :class => "small_text"

View file

@ -1,8 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.message{:id => post.id, :class => ("mine" if current_user.owns?(post))}
= person_image_link(post.person)
= yield post_yield_tag(post)
= = render type_partial(post), :post => post

View file

@ -0,0 +1,32 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}}
= person_image_link(post.person)
.content
.from
= link_to post.person.real_name, post.person
.aspect
%ul
- if post.public?
%li= t('.the_world')
- else
- for aspect in current_user.aspects_with_post( post.id )
%li= link_to aspect.name, aspect
- if current_user.owns?(post)
.right
= link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render type_partial(post), :post => post
.info
%span.time= link_to(how_long_ago(post), photo_path(post))
= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post

View file

@ -2,32 +2,4 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.message{ :data=>{:guid=>post.id}, :class => ("mine" if current_user.owns?(post))}
= person_image_link(post.person)
.content
.from
= link_to post.person.real_name, post.person
.aspect
%ul
- if post.public?
the world
- else
- for aspect in current_user.aspects_with_post( post.id )
%li= link_to aspect.name, aspect
- if current_user.owns?(post)
.right
= render "shared/reshare", :post => post, :current_user => current_user
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= markdownify(post.message)
.info
%span.time= link_to(how_long_ago(post), object_path(post))
= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
= render "comments/comments", :post => post
= markdownify(post.message)

View file

@ -62,6 +62,9 @@ en:
search: "Search"
logout: "logout"
shared:
stream_element:
show_comments: "show comments"
the_world: "the world"
aspect_nav:
all_aspects: "All Aspects"
manage: "Manage"
@ -186,10 +189,8 @@ en:
editing: "Editing"
delete_photo: "Delete Photo"
photo:
show_comments: "show comments"
posted_a_new_photo_to: "posted a new photo to"
posted_a_photo: "posted a photo"
the_world: "the world"
new:
new_photo: "New Photo"
back_to_list: "Back to List"
@ -232,8 +233,6 @@ en:
new_status_message:
tell_me_something_good: "tell me something good"
oh_yeah: "oh yeah!"
status_message:
show_comments: "show comments"
show:
status_message: "Status Message"
comments: "comments"