Media Grid:
* The "Edit Image" link in the attachment modal details is redundant. * After an attachment is deleted in the modal, automatically move to the next attachment in the library. If there are no attachments left, close the modal. See #24716. Built from https://develop.svn.wordpress.org/trunk@29085 git-svn-id: http://core.svn.wordpress.org/trunk@28871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1aefb1c252
commit
ceff8de594
|
@ -303,6 +303,35 @@
|
|||
// Update the selection.
|
||||
this.model.on( 'add', this.select, this );
|
||||
this.model.on( 'remove', this.deselect, this );
|
||||
this.model.on( 'sync', this.afterDelete, this );
|
||||
},
|
||||
|
||||
deleteAttachment: function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
this.lastIndex = this.controller.getCurrentIndex();
|
||||
this.hasNext = this.controller.hasNext();
|
||||
|
||||
media.view.Attachment.Details.prototype.deleteAttachment.apply( this, arguments );
|
||||
},
|
||||
|
||||
afterDelete: function( model ) {
|
||||
if ( ! model.destroyed ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var frame = this.controller, index = this.lastIndex;
|
||||
|
||||
if ( ! frame.library.length ) {
|
||||
media.frame.modal.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.hasNext ) {
|
||||
index -= 1;
|
||||
}
|
||||
frame.model = frame.library.at( index );
|
||||
frame.nextMediaItem();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -290,11 +290,6 @@ function wp_print_media_templates() {
|
|||
<# if ( data.width && data.height ) { #>
|
||||
<div class="dimensions">{{ data.width }} × {{ data.height }}</div>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.can.save ) { #>
|
||||
<a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
|
||||
<a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
|
||||
<# } #>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.fileLength ) { #>
|
||||
|
|
Loading…
Reference in New Issue