Media: Refresh the window-wide uploader whenever a state is activated. Properly unbind controller events. fixes #22504, see #21390.

git-svn-id: https://develop.svn.wordpress.org/trunk@22791 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-11-21 20:34:46 +00:00
parent bf42e8a402
commit e99789f504

View File

@ -937,6 +937,10 @@
if ( this.collection && this.collection.off )
this.collection.off( null, null, this );
// Unbind controller events.
if ( this.controller && this.controller.off )
this.controller.off( null, null, this );
// Recursively dispose child views.
if ( this.views )
this.views.dispose();
@ -1044,6 +1048,7 @@
// Initialize window-wide uploader.
if ( this.options.uploader ) {
this.uploader = new media.view.UploaderWindow({
controller: this,
uploader: {
dropzone: this.modal ? this.modal.$el : this.$el,
container: this.$el
@ -1732,6 +1737,8 @@
// Ensure the dropzone is a jQuery collection.
if ( uploader.dropzone && ! (uploader.dropzone instanceof $) )
uploader.dropzone = $( uploader.dropzone );
this.controller.on( 'activate', this.refresh, this );
},
refresh: function() {