List Tables: Hide 'Empty Trash' and 'Empty Spam' buttons when view is already empty.
Props ivantedja, Presskopp, printsachen1, Jaydeep Rami, mathieuhays, cazm. Fixes #38341. Built from https://develop.svn.wordpress.org/trunk@40297 git-svn-id: http://core.svn.wordpress.org/trunk@40204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
62061bab56
commit
3e189479a7
|
@ -354,7 +354,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) ) {
|
if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $this->has_items() ) {
|
||||||
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
|
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
|
||||||
$title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
|
$title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
|
||||||
submit_button( $title, 'apply', 'delete_all', false );
|
submit_button( $title, 'apply', 'delete_all', false );
|
||||||
|
|
|
@ -177,7 +177,7 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {
|
if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
|
||||||
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -489,7 +489,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
|
if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) {
|
||||||
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -461,6 +461,13 @@ setCommentsList = function() {
|
||||||
updateCountText( 'span.trash-count', trashDiff );
|
updateCountText( 'span.trash-count', trashDiff );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
( ( 'trash' === settings.data.comment_status ) && !getCount( $( 'span.trash-count' ) ) ) ||
|
||||||
|
( ( 'spam' === settings.data.comment_status ) && !getCount( $( 'span.spam-count' ) ) )
|
||||||
|
) {
|
||||||
|
$( '#delete_all' ).hide();
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! isDashboard ) {
|
if ( ! isDashboard ) {
|
||||||
total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
|
total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
|
||||||
if ( $(settings.target).parent().is('span.undo') )
|
if ( $(settings.target).parent().is('span.undo') )
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40296';
|
$wp_version = '4.8-alpha-40297';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue