Media Grid: Close the modal if the attachment is deleted.

props ericlewis.
fixes #28819.

git-svn-id: https://develop.svn.wordpress.org/trunk@29322 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-07-29 14:57:21 +00:00
parent 93aff47ac5
commit fd1652d6bb

View File

@ -362,6 +362,7 @@
initialize: function() {
var self = this;
media.view.Frame.prototype.initialize.apply( this, arguments );
_.defaults( this.options, {
@ -371,12 +372,16 @@
this.gridRouter = this.options.gridRouter;
this.library = this.options.library;
if ( this.options.model ) {
this.model = this.options.model;
} else {
this.model = this.library.at( 0 );
}
// Close the modal if the attachment is deleted.
this.listenTo( this.model, 'destroy', this.close, this );
this.createStates();
this.on( 'content:create:edit-metadata', this.editMetadataMode, this );
@ -385,7 +390,7 @@
// Bind default title creation.
this.on( 'title:create:default', this.createTitle, this );
this.title.mode('default');
this.title.mode( 'default' );
this.options.hasPrevious = this.hasPrevious();
this.options.hasNext = this.hasNext();