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.

Built from https://develop.svn.wordpress.org/trunk@29491


git-svn-id: http://core.svn.wordpress.org/trunk@29269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-08-14 18:51:19 +00:00
parent 571111022e
commit df4cc86671
3 changed files with 9 additions and 3 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 );

File diff suppressed because one or more lines are too long

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; ?>