r83975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83974‎ | r83975 | r83976 >
Date:23:01, 14 March 2011
Author:kaldari
Status:deferred
Tags:
Comment:
adding spinners for non-stash uploading, Bug 26079
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -265,11 +265,17 @@
266266 width: 40px;
267267 }
268268
 269+.mwe-upwiz-mask, .mwe-upwiz-status {
 270+ position: absolute;
 271+ top: 0px;
 272+ left: 0px;
 273+}
 274+
269275 .mwe-upwiz-status-progress {
270276 background: url(24px-spinner-0645ad.gif) no-repeat center center;
271277 }
272278
273 -.mwe-upwiz-status-stashed {
 279+.mwe-upwiz-status-stashed, .mwe-upwiz-status-uploaded {
274280 background: url(32px-Dialog-apply-009900.svg.png) no-repeat center center;
275281 }
276282
@@ -339,6 +345,7 @@
340346 .mwe-upwiz-data {
341347 float: left;
342348 width: 46em;
 349+ margin-bottom: 1em;
343350 }
344351
345352
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -259,9 +259,7 @@
260260 * @param height (optional)
261261 */
262262 setThumbnail: function( selector, width, height ) {
263 - // set the thumbnail on the page to have a loading spinner
264 - $j( selector ).loadingSpinner();
265 -
 263+
266264 var _this = this;
267265 if ( typeof width === 'undefined' || width === null || width <= 0 ) {
268266 width = mw.UploadWizard.config[ 'thumbnailWidth' ];
@@ -273,7 +271,6 @@
274272 }
275273
276274 var callback = function( image ) {
277 - // side effect: will replace thumbnail's loadingSpinner
278275 $j( selector ).html(
279276 $j( '<a/>' )
280277 .attr( { 'href': _this.imageinfo.url,
@@ -286,8 +283,7 @@
287284 )
288285 );
289286 };
290 -
291 - $j( selector ).loadingSpinner();
 287+
292288 _this.getThumbnail( callback, width, height );
293289 }
294290
@@ -2159,7 +2155,6 @@
21602156 // remove ability to edit details
21612157 $j.each( _this.uploads, function( i, upload ) {
21622158 upload.details.div.mask();
2163 - upload.details.div.data( 'mask' ).loadingSpinner();
21642159 } );
21652160
21662161 // add the upload progress bar, with ETA
@@ -2169,14 +2164,21 @@
21702165 [ 'submitting-details' ],
21712166 [ 'complete' ],
21722167 function( upload ) {
 2168+ // activate spinner
 2169+ upload.details.div.data( 'status' ).addClass( 'mwe-upwiz-status-progress' );
21732170 upload.details.submit( function( result ) {
21742171 if ( result && result.upload && result.upload.imageinfo ) {
21752172 upload.extractImageInfo( result.upload.imageinfo );
 2173+ // change spinner to checkmark
 2174+ upload.details.div.data( 'status' ).removeClass( 'mwe-upwiz-status-progress' );
 2175+ upload.details.div.data( 'status' ).addClass( 'mwe-upwiz-status-uploaded' );
21762176 } else {
21772177 // XXX alert the user, maybe don't proceed to step 4.
21782178 mw.log( "error -- final API call did not return image info" );
 2179+ // change spinner to error icon
 2180+ upload.details.div.data( 'status' ).removeClass( 'mwe-upwiz-status-progress' );
 2181+ upload.details.div.data( 'status' ).addClass( 'mwe-upwiz-status-error' );
21792182 }
2180 - upload.details.div.data( 'mask' ).html();
21812183 } );
21822184 },
21832185 endCallback
@@ -2409,19 +2411,26 @@
24102412 $j( el ).find( "select" ).addClass( "masked-hidden" );
24112413 }
24122414
2413 - var mask = $j( '<div />' )
2414 - .css( { 'position' : 'absolute',
2415 - 'top' : '0px',
2416 - 'left' : '0px',
 2415+ var mask = $j( '<div class="mwe-upwiz-mask"/>' )
 2416+ .css( {
 2417+ 'backgroundColor' : 'white',
24172418 'width' : el.offsetWidth + 'px',
24182419 'height' : el.offsetHeight + 'px',
2419 - 'z-index' : 100 } )
 2420+ 'z-index' : 90
 2421+ } );
 2422+
 2423+ var status = $j( '<div class="mwe-upwiz-status"/>' )
 2424+ .css( {
 2425+ 'width' : el.offsetWidth + 'px',
 2426+ 'height' : el.offsetHeight + 'px',
 2427+ 'z-index' : 91
 2428+ } )
24202429 .click( function( e ) { e.stopPropagation(); } );
24212430
24222431 $j( el ).css( { 'position' : 'relative' } )
2423 - .fadeTo( 'fast', 0.5 )
2424 - .append( mask )
2425 - .data( 'mask', mask );
 2432+ .append( mask.fadeTo( 'fast', 0.6 ) )
 2433+ .append( status )
 2434+ .data( 'status', status );
24262435
24272436
24282437 }

Status & tagging log