Make WordPress Core

Changeset 37859


Ignore:
Timestamp:
06/24/2016 03:55:26 PM (8 years ago)
Author:
pento
Message:

Media: Prompt when deleting multiple items from the Media Library

We prompt when deleting a single item from the Media Library, but not when deleting multiple items. This inconsistency is now rectified.

Props southp.
Fixes #28235.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/media.js

    r31996 r37859  
    1 /* global ajaxurl, attachMediaBoxL10n, _wpMediaGridSettings */
     1/* global ajaxurl, attachMediaBoxL10n, _wpMediaGridSettings, showNotice */
    22
    33var findPosts;
     
    100100        $( '#doaction, #doaction2' ).click( function( event ) {
    101101            $( 'select[name^="action"]' ).each( function() {
    102                 if ( $(this).val() === 'attach' ) {
     102                var optionValue = $( this ).val();
     103
     104                if ( 'attach' === optionValue ) {
    103105                    event.preventDefault();
    104106                    findPosts.open();
     107                } else if ( 'delete' === optionValue ) {
     108                    if ( ! showNotice.warn() ) {
     109                        event.preventDefault();
     110                    }
    105111                }
    106112            });
Note: See TracChangeset for help on using the changeset viewer.