make autoexpand work

This commit is contained in:
danielgrippi 2011-09-28 11:21:14 -07:00
parent 42fcf3e394
commit d2d205ee08
5 changed files with 73 additions and 35 deletions

View file

@ -4,7 +4,7 @@
= form_tag( post_comments_path(post_id), :id => "new_comment_on_#{post_id}", :class => 'new_comment', :autocomplete => "off") do
= hidden_field_tag :post_id, post_id, :id => "post_id_on_#{post_id}"
= text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}", :placeholder => t('.comment'), :autofocus => true
= text_area_tag :text, nil, :class => "comment_box",:id => "comment_text_on_#{post_id}", :placeholder => t('.comment'), :autofocus => true
.actions
= link_to "Cancel", post_path(post_id), :class => "cancel_new_comment btn"

View file

@ -2,6 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.reshare
- if post
.photo_area
- if post.is_a?(StatusMessage)
@ -23,7 +24,13 @@
= t('ago', :time => time_ago_in_words(post.created_at))
%span.via
- if post.activity_streams?
= t('.via', :link => link_to("#{post.provider_display_name}", post.actor_url)).html_safe
= t('shared.stream_element.via', :link => link_to("#{post.provider_display_name}", post.actor_url)).html_safe
–
%span.scope_scope
- if post.public?
= t('public')
- else
= t('limited')
- if post.activity_streams?
= link_to image_tag(post.image_url, 'data-small-photo' => post.image_url, 'data-full-photo' => post.image_url, :class => 'stream-photo'), post.object_url, :class => "stream-photo-link"
@ -32,4 +39,6 @@
- else
= t('.deleted')
%hr
.reshare_via
%span
= t('.reshared_via')

View file

@ -661,6 +661,7 @@ en:
other: "%{count} new requests!"
reshares:
reshare:
reshared_via: "reshared via"
reshare_original: "Reshare original"
reshare:
zero: "Reshare"

View file

@ -123,10 +123,9 @@ $(document).ready(function(){
beforeSend: function(){
link.addClass('loading');
},
context: link,
success: function(data){
var textarea = parent.find('textarea').first();
lineHeight = 14;
var textarea = function(target) { return target.closest(".stream_element").find('textarea.comment_box').first()[0] };
link.removeClass('loading')
if(!link.hasClass("add_comment_bottom_link")){
@ -135,7 +134,10 @@ $(document).ready(function(){
container.hide();
parent.append(data);
new MBP.autogrow(textarea);
console.log($(this).closest(".stream_element").find('textarea'));
MBP.autogrow(textarea($(this)));
}
});
}
@ -164,7 +166,7 @@ $(document).ready(function(){
var bottomBar = form.closest('.bottom_bar').first(),
container = bottomBar.find('.add_comment_bottom_link_container'),
commentActionLink = bottomBar.find("a.comment_action").first();
reactionLink = bottomBar.find("a.show_comments").first(),
reactionLink = bottomBar.find(".show_comments").first(),
commentCount = bottomBar.find(".comment_count");
if(container.length > 0) {

View file

@ -55,7 +55,9 @@ body {
weight: bold !important; }; }
margin-bottom: 2px;
height: 45px; }
> .content {
> .content,
.reshare > .content {
padding: 10px {
bottom: 0; }; }
padding: 10px 0;
@ -107,6 +109,7 @@ body {
@include border-radius(3px);
@include box-shadow(0, 1px, 5px, rgba(0, 0, 0, 1));
padding: 0;
padding-bottom: 10px;
background: {
color: #fff;
}
@ -553,3 +556,26 @@ header {
.new_status_message {
min-height: 300px;
}
.reshare {
border-bottom: 1px solid #ccc;
padding: {
bottom: 10px;
}
position: relative;
.reshare_via {
width: 100%;
position: absolute;
bottom: -7px;
text-align: center;
span {
padding: 2px 10px;
font-weight: bold;
color: #999;
background: {
color: #fff;
}
}
}
}