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

Props ericlewis.
Fixes #29104.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-08-03 19:40:17 +00:00
parent 696c12bc55
commit 27890cc734
2 changed files with 15 additions and 14 deletions

View File

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

File diff suppressed because one or more lines are too long