Changeset 7002
- Timestamp:
- 05/06/2013 12:49:35 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-templates/bp-legacy/buddypress-functions.php
r6867 r7002 253 253 'rejected' => __( 'Rejected', 'buddypress' ), 254 254 'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ), 255 'show_x_comments' => __( 'Show all %d comments', 'buddypress' ), 255 256 'show_all' => __( 'Show all', 'buddypress' ), 256 257 'comments' => __( 'comments', 'buddypress' ), -
trunk/bp-templates/bp-legacy/js/buddypress.js
r7000 r7002 444 444 form.append( jq( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) ); 445 445 } else { 446 var activity_comments = form.parent(); 446 447 form.fadeOut( 200, function() { 447 if ( 0 == form.parent().children('ul').length ) {448 if ( form.parent().hasClass('activity-comments') ) {449 form.parent().prepend('<ul></ul>');448 if ( 0 == activity_comments.children('ul').length ) { 449 if ( activity_comments.hasClass('activity-comments') ) { 450 activity_comments.prepend('<ul></ul>'); 450 451 } else { 451 form.parent().append('<ul></ul>');452 activity_comments.append('<ul></ul>'); 452 453 } 453 454 } … … 456 457 var the_comment = jq.trim( response ); 457 458 458 form.parent().children('ul').append( jq( the_comment ).hide().fadeIn( 200 ) );459 activity_comments.children('ul').append( jq( the_comment ).hide().fadeIn( 200 ) ); 459 460 form.children('textarea').val(''); 460 form.parent().parent().addClass('has-comments');461 activity_comments.parent().addClass('has-comments'); 461 462 } ); 462 463 jq( '#' + form.attr('id') + ' textarea').val(''); … … 464 465 /* Increase the "Reply (X)" button count */ 465 466 jq('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 ); 467 468 // Increment the 'Show all x comments' string, if present 469 var show_all_a = activity_comments.find('.show-all').find('a'); 470 if ( show_all_a ) { 471 var new_count = jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html(); 472 show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) ); 473 } 466 474 } 467 475 … … 519 527 var new_count = count_span.html() - ( 1 + child_count ); 520 528 count_span.html(new_count); 529 530 // Change the 'Show all x comments' text 531 var show_all_a = comment_li.siblings('.show-all').find('a'); 532 if ( show_all_a ) { 533 show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) ); 534 } 521 535 522 536 /* If that was the last comment for the item, remove the has-comments class to clean up the styling */ … … 1407 1421 jq(this).toggle(); 1408 1422 1409 if ( !i ) 1410 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_ all + ' ' + comment_count + ' ' + BP_DTheme.comments+ '</a></li>' );1423 if ( !i ) 1424 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' ); 1411 1425 } 1412 1426 }); -
trunk/bp-themes/bp-default/_inc/global.js
r7000 r7002 437 437 form.append( jq( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) ); 438 438 } else { 439 var activity_comments = form.parent(); 439 440 form.fadeOut( 200, function() { 440 if ( 0 == form.parent().children('ul').length ) {441 if ( form.parent().hasClass('activity-comments') ) {442 form.parent().prepend('<ul></ul>');441 if ( 0 == activity_comments.children('ul').length ) { 442 if ( activity_comments.hasClass('activity-comments') ) { 443 activity_comments.prepend('<ul></ul>'); 443 444 } else { 444 form.parent().append('<ul></ul>');445 activity_comments.append('<ul></ul>'); 445 446 } 446 447 } … … 449 450 var the_comment = jq.trim( response ); 450 451 451 form.parent().children('ul').append( jq( the_comment ).hide().fadeIn( 200 ) );452 activity_comments.children('ul').append( jq( the_comment ).hide().fadeIn( 200 ) ); 452 453 form.children('textarea').val(''); 453 form.parent().parent().addClass('has-comments');454 activity_comments.parent().addClass('has-comments'); 454 455 } ); 455 456 … … 458 459 /* Increase the "Reply (X)" button count */ 459 460 jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 ); 461 462 // Increment the 'Show all x comments' string, if present 463 var show_all_a = activity_comments.find('.show-all').find('a'); 464 if ( show_all_a ) { 465 var new_count = jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html(); 466 show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) ); 467 } 460 468 } 461 469 … … 513 521 var new_count = count_span.html() - ( 1 + child_count ); 514 522 count_span.html(new_count); 523 524 // Change the 'Show all x comments' text 525 var show_all_a = comment_li.siblings('.show-all').find('a'); 526 if ( show_all_a ) { 527 show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) ); 528 } 515 529 516 530 /* If that was the last comment for the item, remove the has-comments class to clean up the styling */ … … 1391 1405 1392 1406 if ( !i ) 1393 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_ all + ' ' + comment_count + ' ' + BP_DTheme.comments+ '</a></li>' );1407 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' ); 1394 1408 } 1395 1409 }); -
trunk/bp-themes/bp-default/functions.php
r6726 r7002 160 160 'rejected' => __( 'Rejected', 'buddypress' ), 161 161 'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ), 162 'show_x_comments' => __( 'Show all %d comments', 'buddypress' ), 162 163 'show_all' => __( 'Show all', 'buddypress' ), 163 164 'comments' => __( 'comments', 'buddypress' ),
Note: See TracChangeset
for help on using the changeset viewer.