diff --git a/src/js/_enqueues/admin/edit-comments.js b/src/js/_enqueues/admin/edit-comments.js
index e7a9282d4b..29ff597293 100644
|
a
|
b
|
var getCount, updateCount, updateCountText, updatePending, updateApproved, |
| 302 | 302 | */ |
| 303 | 303 | window.setCommentsList = function() { |
| 304 | 304 | var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff, |
| 305 | | lastConfidentTime = 0; |
| | 305 | getActionFromClass, showUndo, lastConfidentTime = 0; |
| 306 | 306 | |
| 307 | 307 | totalInput = $('input[name="_total"]', '#comments-form'); |
| 308 | 308 | perPageInput = $('input[name="_per_page"]', '#comments-form'); |
| … |
… |
window.setCommentsList = function() { |
| 338 | 338 | totalInput.val( total.toString() ); |
| 339 | 339 | }; |
| 340 | 340 | |
| | 341 | getActionFromClass = function( wpListsData ) { |
| | 342 | if ( wpListsData.indexOf(':trash=1') != -1 ) { |
| | 343 | return { |
| | 344 | action: 'trash', |
| | 345 | undoAction: 'untrash', |
| | 346 | undoClass: ':untrash=1', |
| | 347 | }; |
| | 348 | } |
| | 349 | else if ( wpListsData.indexOf(':spam=1') != -1 ) { |
| | 350 | return { |
| | 351 | action: 'spam', |
| | 352 | undoAction: 'unspam', |
| | 353 | undoClass: ':unspam=1', |
| | 354 | }; |
| | 355 | } |
| | 356 | else if ( wpListsData.indexOf(':action=dim-comment&new=approved') != -1 ) { |
| | 357 | return { |
| | 358 | action: 'approve', |
| | 359 | undoAction: 'unapprove', |
| | 360 | undoClass: 'e7e7d3:action=dim-comment&new=unapproved', |
| | 361 | }; |
| | 362 | } |
| | 363 | else if ( wpListsData.indexOf(':action=dim-comment&new=unapproved') != -1 ) { |
| | 364 | return { |
| | 365 | action: 'unapprove', |
| | 366 | undoAction: 'approve', |
| | 367 | undoClass: 'e7e7d3:action=dim-comment&new=approved', |
| | 368 | }; |
| | 369 | } |
| | 370 | return false; |
| | 371 | }; |
| | 372 | |
| 341 | 373 | /** |
| 342 | 374 | * Changes DOM that need to be changed after a list item has been dimmed. |
| 343 | 375 | * |
| … |
… |
window.setCommentsList = function() { |
| 402 | 434 | * @return {Object} The settings object. |
| 403 | 435 | */ |
| 404 | 436 | delBefore = function( settings, list ) { |
| 405 | | var note, id, el, n, h, a, author, |
| 406 | | action = false, |
| 407 | | wpListsData = $( settings.target ).attr( 'data-wp-lists' ); |
| 408 | | |
| 409 | 437 | settings.data._total = totalInput.val() || 0; |
| 410 | 438 | settings.data._per_page = perPageInput.val() || 0; |
| 411 | 439 | settings.data._page = pageInput.val() || 0; |
| 412 | 440 | settings.data._url = document.location.href; |
| 413 | 441 | settings.data.comment_status = $('input[name="comment_status"]', '#comments-form').val(); |
| 414 | 442 | |
| 415 | | if ( wpListsData.indexOf(':trash=1') != -1 ) |
| 416 | | action = 'trash'; |
| 417 | | else if ( wpListsData.indexOf(':spam=1') != -1 ) |
| 418 | | action = 'spam'; |
| | 443 | if (! $(settings.target).parent().hasClass('undo')) { |
| | 444 | showUndo(settings, list); |
| | 445 | } |
| | 446 | |
| | 447 | return settings; |
| | 448 | } |
| | 449 | |
| | 450 | showUndo = function( settings, list ) { |
| | 451 | var note, id, el, n, h, a, author, undoAction, undoClass, |
| | 452 | action = false, |
| | 453 | wpListsData = $( settings.target ).attr( 'data-wp-lists' ); |
| 419 | 454 | |
| 420 | | if ( action ) { |
| | 455 | |
| | 456 | params = getActionFromClass( wpListsData ); |
| | 457 | |
| | 458 | if ( params ) { |
| 421 | 459 | id = wpListsData.replace(/.*?comment-([0-9]+).*/, '$1'); |
| 422 | 460 | el = $('#comment-' + id); |
| 423 | | note = $('#' + action + '-undo-holder').html(); |
| | 461 | note = $('#' + params.action + '-undo-holder').html(); |
| 424 | 462 | |
| 425 | 463 | el.find('.check-column :checkbox').prop('checked', false); // Uncheck the row so as not to be affected by Bulk Edits. |
| 426 | 464 | |
| … |
… |
window.setCommentsList = function() { |
| 430 | 468 | if ( el.is('tr') ) { |
| 431 | 469 | n = el.children(':visible').length; |
| 432 | 470 | author = $('.author strong', el).text(); |
| 433 | | h = $('<tr id="undo-' + id + '" class="undo un' + action + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>'); |
| | 471 | h = $('<tr id="undo-' + id + '" class="undo ' + params.undoAction + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>'); |
| 434 | 472 | } else { |
| 435 | 473 | author = $('.comment-author', el).text(); |
| 436 | | h = $('<div id="undo-' + id + '" style="display:none;" class="undo un' + action + '">' + note + '</div>'); |
| | 474 | h = $('<div id="undo-' + id + '" style="display:none;" class="undo ' + params.undoAction + '">' + note + '</div>'); |
| 437 | 475 | } |
| 438 | 476 | |
| 439 | 477 | el.before(h); |
| 440 | 478 | |
| 441 | 479 | $('strong', '#undo-' + id).text(author); |
| 442 | 480 | a = $('.undo a', '#undo-' + id); |
| 443 | | a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce); |
| 444 | | a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1'); |
| | 481 | a.attr('href', 'comment.php?action=' + params.undoAction + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce); |
| | 482 | a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + ':' + params.undoClass); |
| 445 | 483 | a.attr('class', 'vim-z vim-destructive aria-button-if-js'); |
| 446 | | $('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside'); |
| | 484 | $('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + params.action + '-undo-inside'); |
| 447 | 485 | |
| 448 | 486 | a.on( 'click', function( e ){ |
| 449 | 487 | e.preventDefault(); |
| … |
… |
window.setCommentsList = function() { |
| 456 | 494 | }); |
| 457 | 495 | } |
| 458 | 496 | |
| 459 | | return settings; |
| 460 | 497 | }; |
| 461 | 498 | |
| 462 | 499 | /** |
| … |
… |
window.setCommentsList = function() { |
| 529 | 566 | } else if ( '0' === commentStatus ) { |
| 530 | 567 | pendingDiff = 1; |
| 531 | 568 | } |
| | 569 | |
| | 570 | // The comment was approved. |
| | 571 | } else if ( targetParent.hasClass( 'unapprove' ) ) { |
| | 572 | approvedDiff = -1; |
| | 573 | pendingDiff = 1; |
| | 574 | |
| | 575 | // The comment was unapproved. |
| | 576 | } else if ( targetParent.hasClass( 'approve' ) ) { |
| | 577 | approvedDiff = 1; |
| | 578 | pendingDiff = -1; |
| 532 | 579 | } |
| 533 | 580 | |
| 534 | 581 | undoing = true; |
| … |
… |
window.setCommentsList = function() { |
| 765 | 812 | .on('wpListDelEnd', function(e, s){ |
| 766 | 813 | var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, ''); |
| 767 | 814 | |
| 768 | | if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.indexOf(':spam=1') != -1 ) |
| | 815 | if ( getActionFromClass( wpListsData ) ) |
| 769 | 816 | $('#undo-' + id).fadeIn(300, function(){ $(this).show(); }); |
| 770 | 817 | }); |
| 771 | 818 | }; |
diff --git a/src/wp-admin/css/dashboard.css b/src/wp-admin/css/dashboard.css
index 76270ae0d3..7b07cb8217 100644
|
a
|
b
|
body #dashboard-widgets .postbox form .submit { |
| 977 | 977 | width: 4px; |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | | #activity-widget #the-comment-list .spam-undo-inside .avatar, |
| 981 | | #activity-widget #the-comment-list .trash-undo-inside .avatar { |
| | 980 | #activity-widget #the-comment-list .undo-inside .avatar { |
| 982 | 981 | position: relative; |
| 983 | 982 | top: 0; |
| 984 | 983 | } |
diff --git a/src/wp-admin/css/edit.css b/src/wp-admin/css/edit.css
index f808cf1c7f..9f57ba80f5 100644
|
a
|
b
|
p.popular-tags a { |
| 1535 | 1535 | margin-left: 1em; |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | | .trash-undo-inside, |
| 1539 | | .spam-undo-inside { |
| | 1538 | .undo-inside { |
| 1540 | 1539 | margin: 1px 8px 1px 0; |
| 1541 | 1540 | line-height: 1.23076923; |
| 1542 | 1541 | } |
| 1543 | 1542 | |
| 1544 | | .spam-undo-inside .avatar, |
| 1545 | | .trash-undo-inside .avatar { |
| | 1543 | .undo-inside .avatar { |
| 1546 | 1544 | height: 20px; |
| 1547 | 1545 | width: 20px; |
| 1548 | 1546 | margin-right: 8px; |
| 1549 | 1547 | vertical-align: middle; |
| 1550 | 1548 | } |
| 1551 | 1549 | |
| | 1550 | .undo-inside .approve { |
| | 1551 | display:inline; |
| | 1552 | } |
| | 1553 | |
| 1552 | 1554 | .stuffbox .editcomment { |
| 1553 | 1555 | clear: none; |
| 1554 | 1556 | margin-top: 0; |
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index 1d4a8e8da1..7e4c1d2d3e 100644
|
a
|
b
|
function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $ |
| 555 | 555 | function wp_comment_trashnotice() { |
| 556 | 556 | ?> |
| 557 | 557 | <div class="hidden" id="trash-undo-holder"> |
| 558 | | <div class="trash-undo-inside"> |
| | 558 | <div class="trash-undo-inside undo-inside"> |
| 559 | 559 | <?php |
| 560 | 560 | /* translators: %s: Comment author, filled by Ajax. */ |
| 561 | 561 | printf( __( 'Comment by %s moved to the Trash.' ), '<strong></strong>' ); |
| … |
… |
function wp_comment_trashnotice() { |
| 564 | 564 | </div> |
| 565 | 565 | </div> |
| 566 | 566 | <div class="hidden" id="spam-undo-holder"> |
| 567 | | <div class="spam-undo-inside"> |
| | 567 | <div class="spam-undo-inside undo-inside"> |
| 568 | 568 | <?php |
| 569 | 569 | /* translators: %s: Comment author, filled by Ajax. */ |
| 570 | 570 | printf( __( 'Comment by %s marked as spam.' ), '<strong></strong>' ); |
| 571 | 571 | ?> |
| 572 | 572 | <span class="undo unspam"><a href="#"><?php _e( 'Undo' ); ?></a></span> |
| 573 | 573 | </div> |
| | 574 | </div> |
| | 575 | <div class="hidden" id="approve-undo-holder"> |
| | 576 | <div class="approve-undo-inside undo-inside"> |
| | 577 | <?php |
| | 578 | /* translators: %s: Comment author, filled by Ajax. */ |
| | 579 | printf( __( 'Comment by %s approved.' ), '<strong></strong>' ); |
| | 580 | ?> |
| | 581 | <span class="undo unapprove"><a href="#"><?php _e( 'Undo' ); ?></a></span> |
| | 582 | </div> |
| | 583 | </div> |
| | 584 | <div class="hidden" id="unapprove-undo-holder"> |
| | 585 | <div class="unapprove-undo-inside undo-inside"> |
| | 586 | <?php |
| | 587 | /* translators: %s: Comment author, filled by Ajax. */ |
| | 588 | printf( __( 'Comment by %s unapproved.' ), '<strong></strong>' ); |
| | 589 | ?> |
| | 590 | <span class="undo approve"><a href="#"><?php _e( 'Undo' ); ?></a></span> |
| | 591 | </div> |
| 574 | 592 | </div> |
| 575 | 593 | <?php |
| 576 | 594 | } |