r89139 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89138‎ | r89139 | r89140 >
Date:22:49, 29 May 2011
Author:janpaul123
Status:ok
Tags:
Comment:
Fix for when image loading fails
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.i18n.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.php (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.php
@@ -112,7 +112,8 @@
113113 'wikilove-err-msg',
114114 'wikilove-err-image',
115115 'wikilove-err-sig',
116 - 'wikilove-barnstar-header',
 116+ 'wikilove-err-gallery',
 117+ 'wikilove-err-gallery-again',
117118 ),
118119 'dependencies' => array(
119120 'jquery.ui.dialog',
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css
@@ -224,6 +224,14 @@
225225 position: relative;
226226 }
227227
 228+/*#mw-wikilove-dialog #mw-wikilove-gallery*/ #mw-wikilove-gallery-error {
 229+ margin-left: 15px;
 230+}
 231+
 232+/*#mw-wikilove-dialog #mw-wikilove-gallery #mw-wikilove-gallery-error*/ #mw-wikilove-gallery-error-again {
 233+ color: #0645AD;
 234+}
 235+
228236 /*#mw-wikilove-dialog*/ #mw-wikilove-gallery img {
229237 margin-right: 5px;
230238 margin-bottom: 5px;
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -68,6 +68,10 @@
6969 <div id="mw-wikilove-subtype-description"></div>\
7070 <label id="mw-wikilove-gallery-label"><html:msg key="wikilove-image"/></label>\
7171 <div id="mw-wikilove-gallery">\
 72+ <div id="mw-wikilove-gallery-error">\
 73+ <html:msg key="wikilove-err-gallery"/>\
 74+ <a href="#" id="mw-wikilove-gallery-error-again"><html:msg key="wikilove-err-gallery-again"/></a>\
 75+ </div>\
7276 <div id="mw-wikilove-gallery-spinner" class="mw-wikilove-spinner"></div>\
7377 <div id="mw-wikilove-gallery-content"></div>\
7478 </div>\
@@ -114,7 +118,7 @@
115119 $( '#mw-wikilove-add-details' ).hide();
116120 $( '#mw-wikilove-preview' ).hide();
117121 $( '#mw-wikilove-types' ).replaceWith( $typeList );
118 -
 122+ $( '#mw-wikilove-gallery-error-again' ).click( $.wikiLove.showGallery );
119123 $( '#mw-wikilove-types a' ).click( $.wikiLove.clickType );
120124 $( '#mw-wikilove-subtype' ).change( $.wikiLove.changeSubtype );
121125 $( '#mw-wikilove-preview-form' ).submit( $.wikiLove.submitPreview );
@@ -424,6 +428,7 @@
425429 $( '#mw-wikilove-gallery-content' ).html( '' );
426430 gallery = {};
427431 $( '#mw-wikilove-gallery-spinner' ).fadeIn( 200 );
 432+ $( '#mw-wikilove-gallery-error' ).hide();
428433
429434 if( typeof currentTypeOrSubtype.gallery.number == 'undefined'
430435 || currentTypeOrSubtype.gallery.number <= 0
@@ -458,10 +463,16 @@
459464 dataType: 'json',
460465 type: 'POST',
461466 success: function( data ) {
462 - if ( !data || !data.query || !data.query.pages || loadingType != currentTypeOrSubtype ) {
 467+ if ( !data || !data.query || !data.query.pages ) {
 468+ $( '#mw-wikilove-gallery-error' ).show();
 469+ $( '#mw-wikilove-gallery-spinner' ).fadeOut( 200 );
463470 return;
464471 }
465472
 473+ if ( loadingType != currentTypeOrSubtype ) {
 474+ return;
 475+ }
 476+
466477 $.each( data.query.pages, function( id, page ) {
467478 if ( page.imageinfo && page.imageinfo.length ) {
468479 // build an image tag with the correct url and width
@@ -491,6 +502,10 @@
492503 index++;
493504 }
494505 } );
 506+ },
 507+ error: function() {
 508+ $( '#mw-wikilove-gallery-error' ).show();
 509+ $( '#mw-wikilove-gallery-spinner' ).fadeOut( 200 );
495510 }
496511 });
497512 },
Index: trunk/extensions/WikiLove/WikiLove.i18n.php
@@ -39,6 +39,8 @@
4040 'wikilove-err-msg' => 'Please enter a message.',
4141 'wikilove-err-image' => 'Please select an image.',
4242 'wikilove-err-sig' => 'Please do not include a signature in the message.',
 43+ 'wikilove-err-gallery' => 'Something went wrong when loading the images!',
 44+ 'wikilove-err-gallery-again' => 'Try again',
4345 );
4446
4547 /** Message documentation (Message documentation)

Status & tagging log