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

props ericlewis.
fixes #28819.
Built from https://develop.svn.wordpress.org/trunk@29322


git-svn-id: http://core.svn.wordpress.org/trunk@29103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-07-29 14:58:19 +00:00
parent 77599cd99b
commit 0c2fe96a31
2 changed files with 7 additions and 2 deletions

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();

File diff suppressed because one or more lines are too long