r100177 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100176‎ | r100177 | r100178 >
Date:22:29, 18 October 2011
Author:neilk
Status:ok
Tags:
Comment:
more correct fix for the multi-file scrolling -- the problem was that it called the moveToStep function just for a side effect, now captured in resetFileStepUploads. Followup r100155
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -354,11 +354,7 @@
355355 var _this = this;
356356
357357 // scroll to the top of the page (the current step might have been very long, vertically)
358 - if ( selectedStepName !== 'file' ) {
359 - // this is the wrong behavior when selecting files (hides interface), so skip it.
360 - // also, it breaks scrolling when selecting multiple files at once.
361 - $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
362 - }
 358+ $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
363359
364360 $j.each( _this.stepNames, function(i, stepName) {
365361
@@ -380,9 +376,8 @@
381377
382378 _this.currentStepName = selectedStepName;
383379
384 - if ( selectedStepName == 'file' && _this.uploads.length === 0 ) {
385 - // add one upload field to start (this is the big one that asks you to upload something)
386 - var upload = _this.newUpload();
 380+ if ( selectedStepName === 'file' ) {
 381+ _this.resetFileStepUploads();
387382 }
388383
389384 $j.each( _this.uploads, function(i, upload) {
@@ -395,6 +390,16 @@
396391 },
397392
398393 /**
 394+ * If there are no uploads, make a new one
 395+ */
 396+ resetFileStepUploads: function() {
 397+ if ( this.uploads.length === 0 ) {
 398+ // add one upload field to start (this is the big one that asks you to upload something)
 399+ var upload = this.newUpload();
 400+ }
 401+ },
 402+
 403+ /**
399404 * add an Upload
400405 * we create the upload interface, a handler to transport it to the server,
401406 * and UI for the upload itself and the "details" at the second step of the wizard.
@@ -732,8 +737,7 @@
733738 _this.allowCloseWindow();
734739 }
735740
736 - // and move back to the file step
737 - _this.moveToStep( 'file' );
 741+ _this.resetFileStepUploads();
738742 }
739743
740744 // allow an "add another upload" button only if we aren't at max

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100155fixed weird scrolling behavior for multi-file selectionraindrift20:28, 18 October 2011

Status & tagging log