r84733 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84732‎ | r84733 | r84734 >
Date:07:58, 25 March 2011
Author:neilk
Status:deferred
Tags:
Comment:
fix bug 28231, final page previews
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -404,7 +404,16 @@
405405 if ( !mw.isEmpty( height ) ) {
406406 height = parseInt( height, 10 );
407407 }
408 -
 408+
 409+ var href = '#';
 410+ $j.each( [ 'descriptionurl', 'url' ], function( i, propName ) {
 411+ var prop = _this.imageinfo[ propName ];
 412+ if ( prop ) {
 413+ href = prop;
 414+ return false;
 415+ }
 416+ } );
 417+
409418 var callback = function( image ) {
410419 if ( image === null ) {
411420 $j( selector ).addClass( 'mwe-upwiz-file-preview-broken' );
@@ -412,7 +421,7 @@
413422 } else {
414423 $j( selector ).html(
415424 $j( '<a/>' )
416 - .attr( { 'href': _this.imageinfo.url,
 425+ .attr( { 'href': href,
417426 'target' : '_new' } )
418427 .append(
419428 $j( '<img/>' )
@@ -1137,18 +1146,22 @@
11381147 .msg( 'mwe-upwiz-thanks-explain', _this.uploads.length ) );
11391148
11401149 $j.each( _this.uploads, function(i, upload) {
1141 - var thanksDiv = $j( '<div class="mwe-upwiz-thanks ui-helper-clearfix"></div>' );
1142 - _this.thanksDiv = thanksDiv;
 1150+ var id = 'thanksDiv' + i;
 1151+ var $thanksDiv = $j( '<div></div>' ).attr( 'id', id ).addClass( "mwe-upwiz-thanks ui-helper-clearfix" );
 1152+ _this.thanksDiv = $thanksDiv;
11431153
1144 - var thumbnailDiv = $j( '<div class="mwe-upwiz-thumbnail mwe-upwiz-thumbnail-side" id="thanks-thumbnail"></div>' );
1145 - upload.setThumbnail( thumbnailDiv );
 1154+ var $thumbnailDiv = $j( '<div class="mwe-upwiz-thumbnail mwe-upwiz-thumbnail-side"></div>' );
 1155+ $thanksDiv.append( $thumbnailDiv );
 1156+ upload.setThumbnail( $thumbnailDiv );
 1157+ //upload.setThumbnail( '#' + id + ' .mwe-upwiz-thumbnail' );
11461158
1147 - thanksDiv.append( thumbnailDiv );
 1159+ // Switch the thumbnail link so that it points to the image description page
 1160+ $thumbnailDiv.find( 'a' ).attr( 'href', upload.imageinfo.descriptionurl );
11481161
11491162 var thumbTitle = String(upload.title);
11501163 var thumbWikiText = "[[" + thumbTitle.replace('_', ' ') + "|thumb|" + gM( 'mwe-upwiz-thanks-caption' ) + "]]";
11511164
1152 - thanksDiv.append(
 1165+ $thanksDiv.append(
11531166 $j( '<div class="mwe-upwiz-data"></div>' )
11541167 .append(
11551168 $j('<p/>').append(
@@ -1172,9 +1185,7 @@
11731186 )
11741187 );
11751188
1176 - $j( '#mwe-upwiz-thanks' ).append( thanksDiv );
1177 - // Switch the thumbnail link so that it points to the image description page
1178 - $j( '#thanks-thumbnail a' ).attr( 'href', upload.imageinfo.descriptionurl );
 1189+ $j( '#mwe-upwiz-thanks' ).append( $thanksDiv );
11791190 } );
11801191 },
11811192

Status & tagging log