comment ajax on mobile.
This commit is contained in:
parent
91c9fffb81
commit
d972802142
7 changed files with 37 additions and 6 deletions
18
app/views/comments/_comments.mobile.haml
Normal file
18
app/views/comments/_comments.mobile.haml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
.comment_stream
|
||||
- unless comments_expanded
|
||||
%ul.show_comments{:class => ("hidden" if post.comments.size <= 3)}
|
||||
%li
|
||||
= comment_toggle( post)
|
||||
|
||||
%ul.comments{:class => ('loaded' if post.comments.size <= 3)}
|
||||
-if post.comments.size > 3 && !comments_expanded
|
||||
= render :partial => 'comments/comment', :collection => post.last_three_comments, :locals => {:post => post}
|
||||
-else
|
||||
= render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post}
|
||||
|
||||
- unless !user_signed_in? || @commenting_disabled
|
||||
.new_comment_form_wrapper{:class => comment_form_wrapper_class(post)}
|
||||
= new_comment_form(post.id, current_user)
|
||||
1
app/views/comments/index.mobile.haml
Normal file
1
app/views/comments/index.mobile.haml
Normal file
|
|
@ -0,0 +1 @@
|
|||
= render :partial => 'comments/comment', :collection => @comments, :locals => {:post => @post}
|
||||
|
|
@ -59,5 +59,5 @@
|
|||
- else
|
||||
= link_to '', post_likes_path(post.id), :class => "image_link like_action inactive"
|
||||
|
||||
= link_to "#{t('reactions', :count => (post.comments.length + post.likes_count))}", post_comments_path(post), :class => 'show_comments'
|
||||
= link_to "#{t('reactions', :count => (post.comments.length + post.likes_count))}", post_comments_path(post, :format => "mobile"), :class => 'show_comments'
|
||||
|
||||
|
|
|
|||
|
|
@ -45,14 +45,15 @@ $(document).ready(function(){
|
|||
|
||||
$("a.show_comments").live('tap click', function(evt){
|
||||
evt.preventDefault();
|
||||
var postId = $(this).data('post-id');
|
||||
parent = $(this).closest(".bottom_bar").first();
|
||||
var link = $(this);
|
||||
var link = $(this),
|
||||
parent = link.closest(".bottom_bar").first();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: link.attr('href'),
|
||||
success: function(data){
|
||||
parent.append(data);
|
||||
var comments = $("<ul class='comments'></ul>");
|
||||
parent.append(comments.append(data));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -81,12 +81,19 @@ body {
|
|||
padding: 10px;
|
||||
}
|
||||
|
||||
.comments {
|
||||
.stream_element .comments {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
.content {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.comment {
|
||||
padding: {
|
||||
top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
|
|
@ -375,3 +382,7 @@ form {
|
|||
-webkit-appearance: none;
|
||||
}
|
||||
}
|
||||
|
||||
.show_comments {
|
||||
font-size: larger;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue