Make WordPress Core


Ignore:
Timestamp:
08/14/2014 06:30:49 PM (11 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-template.php

    r29457 r29490  
    317317                    <# if ( ! data.uploading && data.can.remove ) { #>
    318318                        <?php if ( MEDIA_TRASH ): ?>
     319                        <# if ( 'trash' === data.status ) { #>
     320                            <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
     321                        <# } else { #>
    319322                            <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
     323                        <# } #>
    320324                        <?php else: ?>
    321325                            <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.