* @inheritdoc
*/
mw.ForeignStructuredUpload.BookletLayout.prototype.initialize = function () {
- mw.ForeignStructuredUpload.BookletLayout.parent.prototype.initialize.call( this );
- // Point the CategorySelector to the right wiki as soon as we know what the right wiki is
- this.upload.apiPromise.done( function ( api ) {
- // If this is a ForeignApi, it will have a apiUrl, otherwise we don't need to do anything
- if ( api.apiUrl ) {
- // Can't reuse the same object, CategorySelector calls #abort on its mw.Api instance
- this.categoriesWidget.api = new mw.ForeignApi( api.apiUrl );
- }
- }.bind( this ) );
+ var deferred = $.Deferred();
+ mw.ForeignStructuredUpload.BookletLayout.parent.prototype.initialize.call( this )
+ .done( function () {
+ // Point the CategorySelector to the right wiki
+ this.upload.apiPromise.done( function ( api ) {
+ // If this is a ForeignApi, it will have a apiUrl, otherwise we don't need to do anything
+ if ( api.apiUrl ) {
+ // Can't reuse the same object, CategorySelector calls #abort on its mw.Api instance
+ this.categoriesWidget.api = new mw.ForeignApi( api.apiUrl );
+ }
+ deferred.resolve();
+ }.bind( this ) );
+ }.bind( this ) );
+ return deferred.promise();
};
/**
/**
* Initialize for a new upload
+ *
+ * @return {jQuery.Promise} Promise resolved when everything is initialized
*/
mw.Upload.BookletLayout.prototype.initialize = function () {
this.clear();
this.upload = this.createUpload();
this.setPage( 'upload' );
+ return $.Deferred().resolve().promise();
};
/**
mw.Upload.Dialog.prototype.getSetupProcess = function ( data ) {
return mw.Upload.Dialog.parent.prototype.getSetupProcess.call( this, data )
.next( function () {
- this.uploadBooklet.initialize();
+ return this.uploadBooklet.initialize();
}, this );
};