Make WordPress Core


Ignore:
Timestamp:
08/14/2014 06:30:49 PM (12 years ago)
Author:
wonderboymusic
Message:

Media Grid, support MEDIA_TRASH:

  • Add a setting to _wpMediaViewsL10n.settings: mediaTrash
  • In the attachment edit modal, properly toggle between Trash/Untrash
  • In media.view.Attachment, add a method for untrashAttachment
  • When creating the grid toolbar, switch the setting order of subviews so that media.view.DeleteSelectedButton can listen to the instance of media.view.AttachmentFilters.All to update the text in its UI.
  • Add a new filter to media.view.AttachmentFilters.All, trash, when settings.mediaTrash is true
  • Allow the cached queries in Query.get() to be flushed when race conditions exist and collections need to be refreshed. This is currently only being used when MEDIA_TRASH is set, to refresh the filtered/mirrored collections related to all, trash, and any already queried filter.
  • Cleanup the bootstrapping of media.view.MediaFrame.Manage
  • Allow wp_ajax_query_attachments() to return items from the trash when MEDIA_TRASH is true
  • Allow wp_ajax_save_attachment() to set post_status when MEDIA_TRASH is true. It allows wp_delete_post() to be called, which will trash the attachment instead of deleting when the flag is set.

Props koop for the knowledge sharing and thought partnership.
See #29145.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r29486 r29490  
    28702870        'contentWidth' => $content_width,
    28712871        'months'       => $months,
     2872        'mediaTrash'   => MEDIA_TRASH ? 1 : 0
    28722873    );
    28732874
     
    29322933        'insertIntoPost'         => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
    29332934        'unattached'             => __( 'Unattached' ),
     2935        'trash'                  => __( 'Trash' ),
    29342936        'uploadedToThisPost'     => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
    29352937        'warnDelete'             => __( "You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete." ),
     
    29372939        'bulkSelect'             => __( 'Bulk Select' ),
    29382940        'cancelSelection'        => __( 'Cancel Selection' ),
     2941        'trashSelected'          => __( 'Trash Selected' ),
     2942        'untrashSelected'        => __( 'Untrash Selected' ),
    29392943        'deleteSelected'         => __( 'Delete Selected' ),
    29402944        'deletePermanently'      => __( 'Delete Permanently' ),
Note: See TracChangeset for help on using the changeset viewer.