Media Grid: expose the $.Deffered()
object in media.view.AttachmentsBrowser.updateContent()
so the grid can call Backbone.history.start()
when models actually exist.
This is a lot better then `_.delay( this.pray, 1000 )`, but needs continued study. See #29052. git-svn-id: https://develop.svn.wordpress.org/trunk@29420 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e25dc36c2b
commit
5f2fa44dee
@ -91,6 +91,8 @@
|
|||||||
this.options.uploader = false;
|
this.options.uploader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.gridRouter = new media.view.MediaFrame.Manage.Router();
|
||||||
|
|
||||||
// Call 'initialize' directly on the parent class.
|
// Call 'initialize' directly on the parent class.
|
||||||
media.view.MediaFrame.prototype.initialize.apply( this, arguments );
|
media.view.MediaFrame.prototype.initialize.apply( this, arguments );
|
||||||
|
|
||||||
@ -109,21 +111,6 @@
|
|||||||
}
|
}
|
||||||
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
||||||
}, 1000 ) );
|
}, 1000 ) );
|
||||||
|
|
||||||
// This is problematic.
|
|
||||||
_.delay( _.bind( this.createRouter, this ), 1000 );
|
|
||||||
},
|
|
||||||
|
|
||||||
createRouter: function() {
|
|
||||||
this.gridRouter = new media.view.MediaFrame.Manage.Router();
|
|
||||||
|
|
||||||
// Verify pushState support and activate
|
|
||||||
if ( window.history && window.history.pushState ) {
|
|
||||||
Backbone.history.start({
|
|
||||||
root: _wpMediaGridSettings.adminUrl,
|
|
||||||
pushState: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -210,6 +197,7 @@
|
|||||||
|
|
||||||
scrollElement: document
|
scrollElement: document
|
||||||
});
|
});
|
||||||
|
this.browserView.on( 'ready', _.bind( this.bindDeferred, this ) );
|
||||||
|
|
||||||
this.errors = wp.Uploader.errors;
|
this.errors = wp.Uploader.errors;
|
||||||
this.errors.on( 'add remove reset', this.sidebarVisibility, this );
|
this.errors.on( 'add remove reset', this.sidebarVisibility, this );
|
||||||
@ -217,6 +205,20 @@
|
|||||||
|
|
||||||
sidebarVisibility: function() {
|
sidebarVisibility: function() {
|
||||||
this.browserView.$( '.media-sidebar' ).toggle( this.errors.length );
|
this.browserView.$( '.media-sidebar' ).toggle( this.errors.length );
|
||||||
|
},
|
||||||
|
|
||||||
|
bindDeferred: function() {
|
||||||
|
this.browserView.dfd.done( _.bind( this.startHistory, this ) );
|
||||||
|
},
|
||||||
|
|
||||||
|
startHistory: function() {
|
||||||
|
// Verify pushState support and activate
|
||||||
|
if ( window.history && window.history.pushState ) {
|
||||||
|
Backbone.history.start( {
|
||||||
|
root: _wpMediaGridSettings.adminUrl,
|
||||||
|
pushState: true
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5819,14 +5819,14 @@
|
|||||||
|
|
||||||
if ( ! this.collection.length ) {
|
if ( ! this.collection.length ) {
|
||||||
this.toolbar.get( 'spinner' ).show();
|
this.toolbar.get( 'spinner' ).show();
|
||||||
this.collection.more().done(function() {
|
this.dfd = this.collection.more().done( function() {
|
||||||
if ( ! view.collection.length ) {
|
if ( ! view.collection.length ) {
|
||||||
noItemsView.$el.removeClass( 'hidden' );
|
noItemsView.$el.removeClass( 'hidden' );
|
||||||
} else {
|
} else {
|
||||||
noItemsView.$el.addClass( 'hidden' );
|
noItemsView.$el.addClass( 'hidden' );
|
||||||
}
|
}
|
||||||
view.toolbar.get( 'spinner' ).hide();
|
view.toolbar.get( 'spinner' ).hide();
|
||||||
});
|
} );
|
||||||
} else {
|
} else {
|
||||||
noItemsView.$el.addClass( 'hidden' );
|
noItemsView.$el.addClass( 'hidden' );
|
||||||
view.toolbar.get( 'spinner' ).hide();
|
view.toolbar.get( 'spinner' ).hide();
|
||||||
|
Loading…
Reference in New Issue
Block a user