Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
ilya 2010-10-24 15:18:12 -07:00
commit bd32e09bf3
8 changed files with 80 additions and 68 deletions

View file

@ -2,7 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.comment{:id => post.id}
%li.comment
= person_image_link(post.person)
.content
.from

View file

@ -2,10 +2,9 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%div.comments
%ul.comment_set{:id => post.id}
- for comment in post.comments
= render 'comments/comment', :post => comment
%li.comment.show
= render 'comments/new_comment', :post => post
%ul.comments{:id => post.id}
- for comment in post.comments
= render 'comments/comment', :post => comment
%li.comment.show
= render 'comments/new_comment', :post => post

View file

@ -45,14 +45,14 @@
function processComment(post_id, html){
post = $("*[data-guid='"+post_id+"']'");
$(' .comment_set li:last', post ).before(
$('.comments li:last', post ).before(
$(html).fadeIn("fast", function(){})
);
toggler = $('.show_post_comments', post)
if(toggler.length > 0){
toggler.html(
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
toggler.html().replace(/\d+/,$('.comments', post)[0].childElementCount -1));
if( !$(".comments", post).is(':visible') ){
toggler.click();
@ -63,9 +63,9 @@
function processPost(className, html, aspectIds){
if(onPageForAspects(aspectIds)){
var addPostToStream = function (html){
$("#stream").prepend(
$("#stream:not('.show')").prepend(
$(html).fadeIn("fast", function(){
$("#stream label:first").inFieldLabels();
$("#stream").find("label").first().inFieldLabels();
})
)
};

View file

@ -12,7 +12,7 @@
%li
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => "add a new aspect"
%ul{ :style => "position:absolute;right:0;bottom:0.01em;"}
%ul.right{:style=>"bottom:0;"}
%li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)}
= link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects')

View file

@ -6,13 +6,10 @@
= render 'shared/author_info', :post => @status_message
.span-14.append-1.last
#stream
%h1.show_text
= make_links(@status_message.message)
%h1.show_text
= make_links(@status_message.message)
= "Posted #{how_long_ago(@status_message)} to"
- for aspect in current_user.aspects_with_post( @status_message.id )
= link_to aspect.name, aspect
= how_long_ago(@status_message)
- if current_user.owns? @status_message
%p

View file

@ -5,39 +5,64 @@
$(document).ready(function(){
$('.comment_set').each(function(index) {
var $this = $(this);
if($this.children().length > 1) {
var show_comments_toggle = $this.parent().prev().children(".show_post_comments");
show_comments_toggle.click();
// expand all comments on page load
$("#stream:not('.show')").find('.comments').each(function(index) {
var comments = $(this);
if(comments.children("li").length > 1) {
var show_comments_toggle = comments.closest("li").find(".show_post_comments");
expandComments(show_comments_toggle);
}
});
// comment toggle action
$("#stream:not('.show')").delegate("a.show_post_comments", "click", function(evt) {
evt.preventDefault();
expandComments($(this));
});
// comment submit action
$("#stream").delegate("a.comment_submit", "click", function(evt){
$(this).closest("form").children(".comment_box").attr("rows", 1);
});
$("#stream").delegate("textarea.comment_box", "focus", function(evt){
var commentBox = $(this);
commentBox.attr("rows", 2)
.closest("form").find(".comment_submit").fadeIn(200);
});
$("#stream").delegate("textarea.comment_box", "blur", function(evt){
var commentBox = $(this);
if( !commentBox.val() ) {
commentBox.attr("rows", 1)
.closest("form").find(".comment_submit").hide();
}
});
// reshare button action
$("#stream").delegate(".reshare_button", "click", function(evt){
evt.preventDefault();
var button = $(this);
button.closest(".reshare_pane").children(".reshare_box").show();
button.addClass("active");
});
});//end document ready
$(".show_post_comments").live('click', function(event) {
event.preventDefault();
var $this = $(this);
function expandComments(toggler){
var text = toggler.html();
commentBlock = toggler.closest("li").find("ul.comments", ".content");
if( toggler.hasClass("visible")) {
toggler.removeClass("visible")
.html(text.replace("hide", "show"));
commentBlock.slideUp(150);
if( $this.hasClass( "visible")) {
$this.html($(this).html().replace("hide", "show"));
$this.closest("li").children(".content").children(".comments").slideUp(150);
} else {
$this.html($(this).html().replace("show", "hide"));
$this.closest("li").children(".content").children(".comments").slideDown(150);
toggler.addClass("visible")
.html(text.replace("show", "hide"));
commentBlock.slideDown(150);
}
$(this).toggleClass( "visible" );
});
$(".comment_submit").live('click', function(evt){
$(this).closest("form").children("p .comment_box").attr("rows", 1);
});
$(".reshare_button").live("click", function(e){
e.preventDefault();
var button = $(this);
button.parent(".reshare_pane").children(".reshare_box").show();
button.addClass("active");
});
}

View file

@ -48,7 +48,13 @@ $(document).ready(function(){
}
);
$("#publisher textarea, .comment_box").keydown( function(e) {
$("#publisher").find("textarea").keydown( function(e) {
if (e.keyCode == 13) {
$(this).closest("form").submit();
}
});
$("#stream").delegate("textarea.comment_box", "keydown", function(e){
if (e.keyCode == 13) {
$(this).closest("form").submit();
}
@ -126,17 +132,3 @@ $(".make_profile_photo").live("click", function(){
});
});
$(".comment_box").live("focus",function(evt){
var $this = $(this);
$this.attr("rows", 2);
$this.parents("p").parents("form").children("p").children(".comment_submit").fadeIn(200);
});
$(".comment_box").live('blur', function(evt){
var $this = $(this);
if( $this.val() == '' ) {
$this.parents("p").parents("form").children("p").children(".comment_submit").fadeOut(0);
$this.attr("rows", 1);
}
});

View file

@ -433,11 +433,10 @@ form
:right 1em
#stream.show
div.comments
ul.comments
:display block
ul.comment_set
:margin
:top 0
:margin
:top 0
> li
:border none
:padding 0
@ -447,7 +446,7 @@ form
:border none
#stream div.comments
#stream ul.comments
:display none
.avatar
@ -462,7 +461,7 @@ input.comment_submit
:right -10px
ul.comment_set
ul.comments
:margin 0
:top 1em
:padding 0
@ -794,7 +793,7 @@ h1.big_text
:top 1px solid #999
:bottom 2px solid #eee
.show_post_comments ul.comment_set
.show_post_comments ul.comments
:width 100%
.sub_header