Media Grid, support MEDIA_TRASH:

* Only use the special `trashAttachment` logic when in `edit-metadata` mode.
* Don't support the `trash` filter in the Add Media modal for now.
* Properly toggle trash/untrash logic in the Attachment Details sidebar

See #29145.


git-svn-id: https://develop.svn.wordpress.org/trunk@29491 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-08-14 18:50:04 +00:00
parent 8661fcf0d9
commit 7308949ea3
2 changed files with 8 additions and 2 deletions

View File

@ -5718,7 +5718,8 @@
priority: 50
};
if ( media.view.settings.mediaTrash ) {
if ( media.view.settings.mediaTrash
&& this.controller.activeModes.where( { id: 'grid' } ).length ) {
filters.trash = {
text: l10n.trash,
props: {
@ -6499,7 +6500,8 @@
var library = this.controller.library;
event.preventDefault();
if ( media.view.settings.mediaTrash ) {
if ( media.view.settings.mediaTrash
&& 'edit-metadata' === this.controller.content.mode() ) {
this.model.set( 'status', 'trash' );
this.model.save().done( function() {
library._requery( true );

View File

@ -508,7 +508,11 @@ function wp_print_media_templates() {
<# if ( ! data.uploading && data.can.remove ) { #>
<?php if ( MEDIA_TRASH ): ?>
<# if ( 'trash' === data.status ) { #>
<a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
<# } else { #>
<a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
<# } #>
<?php else: ?>
<a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
<?php endif; ?>