*
* The dialog's closing promise can be used to get details of the upload.
*
+ * If you want to use a different OO.ui.BookletLayout, for example the
+ * mw.ForeignStructuredUpload.BookletLayout, like in the case of of the upload
+ * interface in VisualEditor, you can pass it in the {@link #cfg-bookletClass}:
+ *
+ * var uploadDialog = new mw.Upload.Dialog( {
+ * bookletClass: mw.ForeignStructuredUpload.BookletLayout
+ * } );
+ *
+ *
* @class mw.Upload.Dialog
* @uses mw.Upload
+ * @uses mw.Upload.BookletLayout
* @extends OO.ui.ProcessDialog
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
* @cfg {Function} [bookletClass=mw.Upload.BookletLayout] Booklet class to be
* used for the steps
* @cfg {Object} [booklet] Booklet constructor configuration
* @inheritdoc
* @property title
*/
- /*jshint -W024*/
mw.Upload.Dialog.static.title = mw.msg( 'upload-dialog-title' );
/**
flags: 'safe',
action: 'cancel',
label: mw.msg( 'upload-dialog-button-cancel' ),
- modes: [ 'upload', 'insert', 'info' ]
+ modes: [ 'upload', 'insert' ]
+ },
+ {
+ flags: 'safe',
+ action: 'cancelupload',
+ label: mw.msg( 'upload-dialog-button-back' ),
+ modes: [ 'info' ]
},
{
flags: [ 'primary', 'progressive' ],
modes: 'insert'
},
{
- flags: [ 'primary', 'constructive' ],
+ flags: [ 'primary', 'progressive' ],
label: mw.msg( 'upload-dialog-button-save' ),
action: 'save',
modes: 'info'
}
];
- /*jshint +W024*/
-
/* Methods */
/**
* @return {mw.Upload.BookletLayout} An upload booklet
*/
mw.Upload.Dialog.prototype.createUploadBooklet = function () {
+ // eslint-disable-next-line new-cap
return new this.bookletClass( $.extend( {
$overlay: this.$overlay
}, this.bookletConfig ) );
* @inheritdoc
*/
mw.Upload.Dialog.prototype.getBodyHeight = function () {
- return 300;
+ return 600;
};
/**
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 );
};
if ( action === 'cancel' ) {
return new OO.ui.Process( this.close() );
}
+ if ( action === 'cancelupload' ) {
+ return new OO.ui.Process( this.uploadBooklet.initialize() );
+ }
return mw.Upload.Dialog.parent.prototype.getActionProcess.call( this, action );
};
this.uploadBooklet.clear();
}, this );
};
-
}( jQuery, mediaWiki ) );