r89960 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89959‎ | r89960 | r89961 >
Date:13:48, 13 June 2011
Author:neilk
Status:resolved (Comments)
Tags:
Comment:
bring back lightbox-ish preview
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
@@ -95,6 +95,7 @@
9696 mw.UploadWizard.config[ 'thumbnailWidth' ],
9797 mw.UploadWizard.config[ 'thumbnailMaxHeight' ]
9898 );
 99+ _this.upload.setLightBox( $preview );
99100
100101 };
101102
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -622,10 +622,7 @@
623623 src: image.src
624624 } )
625625 .css( {
626 - //'position': 'absolute',
627 - //'top': '50%',
628 - //'height': height.toString() + 'px',
629 - 'margin-top': ( parseInt( ( 100 - image.height * scaling ) / 2, 10 ) ).toString() + 'px'
 626+ 'margin-top': ( parseInt( ( height - image.height * scaling ) / 2, 10 ) ).toString() + 'px'
630627 } )
631628 )
632629 );
@@ -658,7 +655,38 @@
659656
660657 },
661658
 659+ /**
 660+ * set up lightbox behavior for non-complete thumbnails
 661+ * TODO center this
 662+ * @param selector
 663+ */
 664+ setLightBox: function( selector ) {
 665+ var _this = this;
 666+ var $imgDiv = $j( '<div></div>' ).css( 'text-align', 'center' );
 667+ $j( selector )
 668+ .click( function() {
 669+ // get large preview image
 670+ // open large preview in modal dialog box
 671+ $j( '<div class="mwe-upwiz-lightbox"></div>' )
 672+ .append( $imgDiv )
 673+ .dialog( {
 674+ 'width': mw.UploadWizard.config[ 'largeThumbnailWidth' ],
 675+ 'height': mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ],
 676+ 'autoOpen': true,
 677+ 'title': gM( 'mwe-upwiz-image-preview' ),
 678+ 'modal': true,
 679+ 'resizable': false
 680+ } );
 681+ _this.setThumbnail(
 682+ $imgDiv,
 683+ mw.UploadWizard.config[ 'largeThumbnailWidth' ],
 684+ mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ]
 685+ );
 686+ return false;
 687+ } ); // close thumbnail click function
 688+ },
662689
 690+
663691 /**
664692 * Given a filename like "Foo.jpg", get the URL to that filename, assuming the browser is on the same wiki.
665693 * Candidate for a utility function...
@@ -678,8 +706,8 @@
679707
680708
681709 /**
682 - * Object that reperesents the entire multi-step Upload Wizard
683 - */
 710+* Object that reperesents the entire multi-step Upload Wizard
 711+*/
684712 mw.UploadWizard = function( config ) {
685713
686714 this.uploads = [];
@@ -1589,7 +1617,7 @@
15901618 var thumbnailDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-thumbnail' );
15911619 $j( '#mwe-upwiz-deeds-thumbnails' ).append( thumbnailDiv );
15921620 _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'thumbnailWidth' ], mw.UploadWizard.config[ 'thumbnailMaxHeight' ] );
1593 - _this.upload.deedThumbnailDiv = thumbnailDiv;
 1621+ _this.upload.setLightBox( thumbnailDiv );
15941622 }
15951623 };
15961624
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -453,6 +453,7 @@
454454 populate: function() {
455455 var _this = this;
456456 _this.upload.setThumbnail( _this.thumbnailDiv, mw.UploadWizard.config['thumbnailWidth'], mw.UploadWizard.config['thumbnailMaxHeight'] );
 457+ _this.upload.setLightBox( _this.thumbnailDiv );
457458 _this.prefillDate();
458459 _this.prefillSource();
459460 _this.prefillAuthor();

Follow-up revisions

RevisionCommit summaryAuthorDate
r89989after UploadWizard reset, need to purge DeedPreviews (which are now their own...neilk18:27, 13 June 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   18:24, 13 June 2011

r89962 delays the lightbox setup until the thumb's ready.

deedThumbnailDiv no longer gets set, but there's still code to remove one in UploadWizardUpload.remove... does that need to be retooled to match?

#Comment by NeilK (talk | contribs)   19:25, 13 June 2011

fixed deedThumbnailDiv issue in r89989

Status & tagging log