Media Grid: don't blow away the Attachment Details modal every time a new model is loaded.

Props ericlewis.
Fixes #29104.


git-svn-id: https://develop.svn.wordpress.org/trunk@29368 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-08-03 19:39:58 +00:00
parent e7eca9d99b
commit 05bb106161
1 changed files with 14 additions and 13 deletions

View File

@ -478,18 +478,17 @@
},
/**
* Close this modal and immediately open another one.
*
* Allows for quickly swapping out the attachment being edited.
* Rerender the view.
*/
resetContent: function() {
this.modal.close();
wp.media( {
frame: 'edit-attachments',
gridRouter: this.gridRouter,
library: this.library,
model: this.model
} );
rerender: function() {
// Only rerender the `content` region.
if ( this.content.mode() !== 'edit-metadata' ) {
this.content.mode( 'edit-metadata' );
} else {
this.content.render();
}
this.$('.left').toggleClass( 'disabled', ! this.hasPrevious() );
this.$('.right').toggleClass( 'disabled', ! this.hasNext() );
},
/**
@ -500,7 +499,8 @@
return;
}
this.model = this.library.at( this.getCurrentIndex() - 1 );
this.resetContent();
this.rerender();
},
/**
@ -511,7 +511,8 @@
return;
}
this.model = this.library.at( this.getCurrentIndex() + 1 );
this.resetContent();
this.rerender();
},
getCurrentIndex: function() {