Put avatar on cmment form all the time, fix socketed comment form

This commit is contained in:
Raphael Sofaer 2011-02-10 11:05:12 -08:00
parent f1c63939f9
commit a307519e94
6 changed files with 19 additions and 21 deletions

View file

@ -12,9 +12,9 @@ module StreamHelper
end
end
def new_comment_form(post_id)
def new_comment_form(post_id, current_user)
@form ||= controller.render_to_string(
:partial => 'comments/new_comment', :locals => {:post_id => GSUB_THIS})
:partial => 'comments/new_comment', :locals => {:post_id => GSUB_THIS, :current_user => current_user})
@form.gsub(GSUB_THIS, post_id.to_s)
end
end

View file

@ -19,4 +19,4 @@
- unless @commenting_disabled
%li.comment.show
= new_comment_form(post_id)
= new_comment_form(post_id, current_user)

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file.
= form_tag( comments_path, :id => "new_comment_on_#{post_id}", :class => 'new_comment', :remote => true) do
= owner_image_tag
= person_image_tag(current_user, nil)
%p
= label_tag "comment_text_on_#{post_id}", t('.comment')
= text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}"

View file

@ -34,4 +34,4 @@
%span.timeago= link_to(how_long_ago(post), status_message_path(post))
= link_to t('comments.new_comment.comment').downcase, '#', :class => 'focus_comment_textarea'
= render "comments/comments", :post_id => post.id, :comments => post.comments, :condensed => true, :commenting_disabled => defined?(@commenting_disabled)
= render "comments/comments", :post_id => post.id, :comments => post.comments, :current_user => current_user, :condensed => true, :commenting_disabled => defined?(@commenting_disabled)

View file

@ -120,10 +120,12 @@ var WebSocketReceiver = {
addPostToStream: function(postId, html) {
if( $(".stream_element[data-guid='" + postId + "']").length == 0 ) {
var streamElement = $(html);
var showMessage = function() {
$("#main_stream:not('.show')").prepend(
$(html).fadeIn("fast", function() {
$("#main_stream").find("label").first().inFieldLabels();
streamElement.fadeIn("fast", function() {
streamElement.find("label").inFieldLabels();
})
);
};
@ -133,9 +135,8 @@ var WebSocketReceiver = {
} else {
showMessage();
}
Diaspora.widgets.timeago.updateTimeAgo();
}
Diaspora.widgets.timeago.updateTimeAgo();
$("label").inFieldLabels();
},
onPageForClass: function(className) {

View file

@ -600,10 +600,16 @@ ul.show_comments
:size 1em
:margin
:bottom -3px
:width 482px
:width 445px
:min-height 23px
.avatar
:display none
p
:position relative
:left 36px
.avatar
:position absolute
:display inline
form.open
.submit_button
@ -611,18 +617,9 @@ ul.show_comments
:margin
:bottom 2px
:right 2px
textarea
:min-height 2.4em
:width 445px
p
:position relative
:left 36px
.avatar
:position absolute
:display inline
.stream.show
ul.comments