WordPress.org

Make WordPress Core

Changeset 6545


Ignore:
Timestamp:
01/03/2008 10:24:58 PM (14 years ago)
Author:
matt
Message:

Update both of the comment counts when something changes.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/edit-comments.js

    r6312 r6545  
    33
    44var dimAfter = function( r, settings ) {
    5     var a = $('#awaitmod');
    6     var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
    7     a.html( n.toString() );
     5    $('.comment-count').each( function() {
     6        var a = $('#' + this.id );
     7        var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
     8        a.html( n.toString() );
     9    });
    810}
    911
    1012var delAfter = function( r, settings ) {
    11     var a = $('#awaitmod');
    12     if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) {
    13         var n = parseInt(a.html(),10) - 1;
    14         a.html( n.toString() );
    15     }
     13    $('.comment-count').each( function() {
     14        var a = $('#' + this.id );
     15        if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) {
     16            var n = parseInt(a.html(),10) - 1;
     17            a.html( n.toString() );
     18        }
     19    });
    1620
    1721    if ( extra.size() == 0 || extra.children().size() == 0 ) {
  • trunk/wp-admin/menu.php

    r6468 r6545  
    1919if ( 100 < $awaiting_mod )
    2020    $awaiting_mod = '99+'; // to not blow out layout
    21 $menu[15] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod'>$awaiting_mod</span>" ), 'edit_posts', 'edit-comments.php');
     21$menu[15] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='comment-count'>$awaiting_mod</span>" ), 'edit_posts', 'edit-comments.php');
    2222$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
    2323$menu[25] = array(__('Design'), 'switch_themes', 'themes.php');
     
    3636$submenu['edit-comments.php'][5] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
    3737$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
    38 $submenu['edit-comments.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "<span id='awaitmod'>$awaiting_mod</span>"), 'edit_posts', 'moderation.php');
     38$submenu['edit-comments.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "<span id='awaitmod' class='comment-count'>$awaiting_mod</span>"), 'edit_posts', 'moderation.php');
    3939
    4040
Note: See TracChangeset for help on using the changeset viewer.