Merge "Change delimiter for multiple namespaces and tags"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Upload.Dialog.js
index 03e3971..9d9c0a6 100644 (file)
         *
         * 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
@@ -47,7 +60,6 @@
         * @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' ],
@@ -68,7 +86,7 @@
                        modes: 'insert'
                },
                {
-                       flags: [ 'primary', 'constructive' ],
+                       flags: [ 'primary', 'progressive' ],
                        label: mw.msg( 'upload-dialog-button-save' ),
                        action: 'save',
                        modes: 'info'
@@ -81,8 +99,6 @@
                }
        ];
 
-       /*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 ) );