mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
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. Built from https://develop.svn.wordpress.org/trunk@29420 git-svn-id: http://core.svn.wordpress.org/trunk@29198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
582b5144b2
commit
935f10413e
@ -91,6 +91,8 @@
|
||||
this.options.uploader = false;
|
||||
}
|
||||
|
||||
this.gridRouter = new media.view.MediaFrame.Manage.Router();
|
||||
|
||||
// Call 'initialize' directly on the parent class.
|
||||
media.view.MediaFrame.prototype.initialize.apply( this, arguments );
|
||||
|
||||
@ -109,21 +111,6 @@
|
||||
}
|
||||
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
||||
}, 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
|
||||
});
|
||||
this.browserView.on( 'ready', _.bind( this.bindDeferred, this ) );
|
||||
|
||||
this.errors = wp.Uploader.errors;
|
||||
this.errors.on( 'add remove reset', this.sidebarVisibility, this );
|
||||
@ -217,6 +205,20 @@
|
||||
|
||||
sidebarVisibility: function() {
|
||||
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
|
||||
} );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
2
wp-includes/js/media-grid.min.js
vendored
2
wp-includes/js/media-grid.min.js
vendored
File diff suppressed because one or more lines are too long
@ -5819,14 +5819,14 @@
|
||||
|
||||
if ( ! this.collection.length ) {
|
||||
this.toolbar.get( 'spinner' ).show();
|
||||
this.collection.more().done(function() {
|
||||
this.dfd = this.collection.more().done( function() {
|
||||
if ( ! view.collection.length ) {
|
||||
noItemsView.$el.removeClass( 'hidden' );
|
||||
} else {
|
||||
noItemsView.$el.addClass( 'hidden' );
|
||||
}
|
||||
view.toolbar.get( 'spinner' ).hide();
|
||||
});
|
||||
} );
|
||||
} else {
|
||||
noItemsView.$el.addClass( 'hidden' );
|
||||
view.toolbar.get( 'spinner' ).hide();
|
||||
|
2
wp-includes/js/media-views.min.js
vendored
2
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user