diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index cfb18b30c7e918cb215f54c17258a7af6fa5ff17..9e8f35c2a4a35e61719b8448b2784ce9cfe853ac 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -26,10 +26,10 @@ class CommentsController < ApplicationController :comment_id => @comment.id, :html => render_to_string( :partial => 'comments/comment', - :locals => { + :locals => { :hash => { :comment => @comment, :person => current_user, - } + }} ) } render(:json => json, :status => 201) diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb index 430264fee21184b73569e1ec056b42dd9ea1bf10..44481788cc9b42a4db12e27dfd6e89f7efedb07e 100644 --- a/app/helpers/sockets_helper.rb +++ b/app/helpers/sockets_helper.rb @@ -27,7 +27,7 @@ module SocketsHelper elsif object.is_a? Person v = render_to_string(:partial => type_partial(object), :locals => {:single_aspect_form => opts[:single_aspect_form], :person => object, :aspects => user.aspects, :current_user => user}) elsif object.is_a? Comment - v = render_to_string(:partial => 'comments/comment', :locals => {:comment => object, :person => object.person}) + v = render_to_string(:partial => 'comments/comment', :locals => {:hash => {:comment => object, :person => object.person}}) else v = render_to_string(:partial => type_partial(object), :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction end diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 7071e9ccc2ccd048d0727e1bb864e2afdfb4963e..719b8c22d26a938ce80a079006572c68e6cc0ee6 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -1,7 +1,8 @@ -# Copyright (c) 2010, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - +- comment = hash[:comment] +- person = hash[:person] %li.comment{:data=>{:guid=>comment.id}} %a{:href => "/people/#{person.id}"} %img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id} diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.html.haml index 41b716ea631d22673c96dec9c0a13755f7a824a4..3d80c6cf399cf3c5abff8c859dd52b4e80dec09c 100644 --- a/app/views/comments/_comments.html.haml +++ b/app/views/comments/_comments.html.haml @@ -3,19 +3,7 @@ -# the COPYRIGHT file. %ul.comments{:id => post_id, :class => ("hidden" if comment_hashes.size == 0)} - - for comment_hash in comment_hashes - -comment = comment_hash[:comment] - -person = comment_hash[:person] - - %li.comment{:data=>{:guid=>comment.id}} - %a{:href => "/people/#{person.id}"} - %img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id} - .content - .from - %a{:href => "/people/#{person.id}"}=person.real_name - = markdownify(comment.text, :youtube_maps => comment[:youtube_titles]) - %div.time - = comment.created_at ? "#{time_ago_in_words(comment.created_at)}" : Time.now + = render :partial => 'comments/comment', :collection => comment_hashes, :as => :hash %li.comment.show = render 'comments/new_comment', :post_id => post_id