Make WordPress Core

Ticket #11200: 11200.diff

File 11200.diff, 3.1 KB (added by scribu, 15 years ago)
  • wp-admin/edit-comments.php

     
    154154<?php
    155155$status_links = array();
    156156$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
    157 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
    158 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
     157
    159158$stati = array(
    160159                'all' => _n_noop('All', 'All'), // singular not used
     160                'approved' => _n_noop('Approved <span class="count">(<span class="approved-count">%s</span>)</span>', 'Approved <span class="count">(<span class="approved-count">%s</span>)</span>'),
    161161                'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
    162                 'approved' => _n_noop('Approved', 'Approved'), // singular not used
    163162                'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
    164163                'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
    165164        );
  • wp-admin/js/edit-comments.dev.js

     
    141141
    142142        // In admin-ajax.php, we send back the unix time stamp instead of 1 on success
    143143        delAfter = function( r, settings ) {
    144                 var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), spam, trash;
     144                var total, appr, pageLinks, N, spam, trash, untrash, unapproved;
    145145
    146146                function getUpdate(s) {
    147147                        if ( $(settings.target).parent().is('span.' + s) )
    148148                                return 1;
    149                         else if ( $('#' + settings.element).is('.' + s) )
     149                       
     150                        if ( $('#' + settings.element).is('.' + s) )
    150151                                return -1;
    151152
    152153                        return 0;
    153154                }
     155
     156                appr = $('span.approved-count');
     157                apprN = getCount(appr);
    154158                spam = getUpdate('spam');
    155159                trash = getUpdate('trash');
     160                untrash = $(settings.target).parent().is('span.untrash');
     161                unapproved = $('#' + settings.element).is('.unapproved');
    156162
    157163                if ( untrash )
    158164                        trash = -1;
    159165
    160166                $('span.pending-count').each( function() {
    161                         var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved');
     167                        var a = $(this), n = getCount(a);
    162168
    163169                        if ( $(settings.target).parent().is('span.unapprove') || ( untrash && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
    164170                                n = n + 1;
     171                                updateCount(appr, apprN-1);
    165172                        } else if ( unapproved ) { // we deleted a formerly unapproved comment
    166173                                n = n - 1;
     174                                updateCount(appr, apprN+1);
    167175                        }
    168176                        if ( n < 0 ) { n = 0; }
    169177                        a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');