MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/184686
Change subject: Move showTooManyFilesWarning to Upload step and ui
......................................................................
Move showTooManyFilesWarning to Upload step and ui
Bug: T86679
Change-Id: I2597217aefd744e80900fc9ede960d7b80c00955
---
M resources/controller/uw.controller.Upload.js
M resources/mw.UploadWizard.js
M resources/ui/uw.ui.Upload.js
3 files changed, 57 insertions(+), 35 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/86/184686/1
diff --git a/resources/controller/uw.controller.Upload.js
b/resources/controller/uw.controller.Upload.js
index 31c0463..0153dfa 100644
--- a/resources/controller/uw.controller.Upload.js
+++ b/resources/controller/uw.controller.Upload.js
@@ -18,10 +18,19 @@
( function ( uw, $, oo ) {
var UP;
- function Upload() {
+ /**
+ * Upload step controller.
+ * @class uw.controller.Upload
+ * @extends uw.controller.Step
+ * @constructor
+ * @param {Object} config UploadWizard config object.
+ */
+ function Upload( config ) {
+ this.config = config;
+
uw.controller.Step.call(
this,
- new uw.ui.Upload()
+ new uw.ui.Upload( config )
.connect( this, {
retry: [ 'emit', 'retry' ],
'next-step': [ 'emit', 'next-step' ],
@@ -49,6 +58,15 @@
this.ui.updateFileCounts( haveUploads, fewerThanMax );
};
+ /**
+ * Shows an error dialog informing the user that some uploads have been
omitted
+ * since they went over the max files limit.
+ * @param filesUploaded integer - the number of files that have been
attempted to upload
+ */
+ UP.showTooManyFilesWarning = function ( filesUploaded ) {
+ this.ui.showTooManyFilesWarning( filesUploaded );
+ };
+
UP.empty = function () {
this.ui.empty();
};
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index fac0395..fbe673f 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -40,7 +40,7 @@
.on( 'next-step', function () {
wizard.moveToStep( 'file' );
} ),
- file: new uw.controller.Upload()
+ file: new uw.controller.Upload( config )
.on( 'retry', function () {
uw.eventFlowLogger.logEvent(
'retry-uploads-button-clicked' );
wizard.startUploads();
@@ -317,7 +317,7 @@
tooManyFiles = totalFiles >
mw.UploadWizard.config.maxUploads;
if ( tooManyFiles ) {
- wizard.showTooManyFilesWarning(
totalFiles );
+
wizard.steps.file.showTooManyFilesWarning( totalFiles );
upload.resetFileInput();
return;
}
@@ -378,36 +378,6 @@
} );
return upload;
- },
-
- /**
- * Shows an error dialog informing the user that some uploads
have been omitted
- * since they went over the max files limit.
- * @param filesUploaded integer - the number of files that have
been attempted to upload
- */
- showTooManyFilesWarning: function ( filesUploaded ) {
- var buttons = [
- {
- text: mw.message(
'mwe-upwiz-too-many-files-ok' ).escaped(),
- click: function () {
-
$(this).dialog('destroy').remove();
- }
- }
- ];
- $( '<div>' )
- .msg(
- 'mwe-upwiz-too-many-files-text',
- mw.UploadWizard.config.maxUploads,
- filesUploaded
- )
- .dialog( {
- width: 500,
- zIndex: 200000,
- autoOpen: true,
- title: mw.message(
'mwe-upwiz-too-many-files' ).escaped(),
- modal: true,
- buttons: buttons
- } );
},
/**
diff --git a/resources/ui/uw.ui.Upload.js b/resources/ui/uw.ui.Upload.js
index 78ed47b..521616d 100644
--- a/resources/ui/uw.ui.Upload.js
+++ b/resources/ui/uw.ui.Upload.js
@@ -23,9 +23,12 @@
* @class uw.ui.Upload
* @extends uw.ui.Step
* @constructor
+ * @param {Object} config UploadWizard config object.
*/
- function Upload() {
+ function Upload( config ) {
var upload = this;
+
+ this.config = config;
ui.Step.call(
this,
@@ -190,5 +193,36 @@
.hide();
};
+ /**
+ * Shows an error dialog informing the user that some uploads have been
omitted
+ * since they went over the max files limit.
+ * @param filesUploaded integer - the number of files that have been
attempted to upload
+ */
+ UP.showTooManyFilesWarning = function ( filesUploaded ) {
+ var buttons = [
+ {
+ text: mw.message( 'mwe-upwiz-too-many-files-ok'
).escaped(),
+ click: function () {
+ $( this ).dialog('destroy').remove();
+ }
+ }
+ ];
+
+ $( '<div>' )
+ .msg(
+ 'mwe-upwiz-too-many-files-text',
+ this.config.maxUploads,
+ filesUploaded
+ )
+ .dialog( {
+ width: 500,
+ zIndex: 200000,
+ autoOpen: true,
+ title: mw.message( 'mwe-upwiz-too-many-files'
).escaped(),
+ modal: true,
+ buttons: buttons
+ } );
+ };
+
ui.Upload = Upload;
}( mediaWiki, jQuery, mediaWiki.uploadWizard.ui, OO ) );
--
To view, visit https://gerrit.wikimedia.org/r/184686
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2597217aefd744e80900fc9ede960d7b80c00955
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits