r81838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81837‎ | r81838 | r81839 >
Date:19:30, 9 February 2011
Author:neilk
Status:deferred
Tags:
Comment:
removed concept of maskSafeHidden from deeds - entire form can be hidden in more normal jquery manner
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -308,8 +308,10 @@
309309
310310
311311 /**
 312+ * Interface widget to choose among various deeds -- for instance, if own work, or not own work, or other such cases.
312313 * @param selector where to put this deed chooser
313 - * @param isPlural whether this chooser applies to multiple files (changes messaging mostly)
 314+ * @param deeds Array of UploadWizardDeed
 315+ * @param uploadCount whether this chooser applies to multiple files (changes messaging mostly)
314316 */
315317 mw.UploadWizardDeedChooser = function( selector, deeds, uploadCount ) {
316318 var _this = this;
@@ -326,16 +328,14 @@
327329
328330 $j.each( deeds, function (i, deed) {
329331 var id = _this.name + '-' + deed.name;
330 -
331332 var $deedInterface = $j(
332333 '<div class="mwe-upwiz-deed mwe-upwiz-deed-' + deed.name + '">'
333334 + '<div class="mwe-upwiz-deed-option-title">'
334335 + '<span class="mwe-upwiz-deed-header">'
335 - + '<input id="' + id +'" name="' + _this.name + '" type="radio" value="' + deed.name + '">'
336 - + '<label for="' + id + '" class="mwe-upwiz-deed-name">'
337 - + gM( 'mwe-upwiz-source-' + deed.name, _this.uploadCount )
338 - + '</label>'
339 - + '</input>'
 336+ + '<input id="' + id +'" name="' + _this.name + '" type="radio" value="' + deed.name + ' /">'
 337+ + '<label for="' + id + '" class="mwe-upwiz-deed-name">'
 338+ + gM( 'mwe-upwiz-source-' + deed.name, _this.uploadCount )
 339+ + '</label>'
340340 + '</span>'
341341 + '</div>'
342342 + '<div class="mwe-upwiz-deed-form">'
@@ -347,17 +347,19 @@
348348 deed.setFormFields( $deedInterface.find( '.mwe-upwiz-deed-form' ) );
349349
350350 $deedInterface.find( 'span.mwe-upwiz-deed-header input' ).click( function() {
351 - if ( $j( this ).is(':checked' ) ) {
 351+ if ( $j( this ).is( ':checked' ) ) {
352352 _this.choose( deed );
353 - _this.showDeed( $deedInterface );
 353+ _this.selectDeedInterface( $deedInterface );
354354 }
355355 } );
356356
357357 } );
358358
 359+ // deselect all deeds
 360+ _this.deselectDeedInterface( this.$selector.find( '.mwe-upwiz-deed' ) );
 361+
 362+ // set the "value" to be the null deed; which will cause an error if the data is submitted.
359363 _this.choose( mw.UploadWizardNullDeed );
360 - _this.showDeedChoice();
361 -
362364
363365 };
364366
@@ -423,37 +425,36 @@
424426 }
425427 },
426428
427 - /**
428 - * Go back to original source choice.
429 - */
430 - showDeedChoice: function() {
431 - var $allDeeds = this.$selector.find( '.mwe-upwiz-deed' );
432 - this.deselectDeed( $allDeeds );
433 - // $allDeeds.fadeTo( 'fast', 1.0 ); //maskSafeShow();
434 - },
435 -
436429 /**
437430 * From the deed choices, make a choice fade to the background a bit, hide the extended form
438431 */
439 - deselectDeed: function( $deedSelector ) {
 432+ deselectDeedInterface: function( $deedSelector ) {
440433 $deedSelector.removeClass( 'selected' );
441 - // $deedSelector.find( 'a.mwe-upwiz-macro-deeds-return' ).hide();
442 - $deedSelector.find( '.mwe-upwiz-deed-form' ).slideUp( 500 ); //.maskSafeHide();
 434+ $j.each( $deedSelector.find( '.mwe-upwiz-deed-form' ), function( i, form ) {
 435+ var $form = $j( form );
 436+ if ( $form.parents().is( ':hidden' ) ) {
 437+ $form.hide();
 438+ } else {
 439+ $form.slideUp( 500 );
 440+ }
 441+ } );
443442 },
444443
445444 /**
446445 * From the deed choice page, show a particular deed
447446 */
448 - showDeed: function( $deedSelector ) {
 447+ selectDeedInterface: function( $deedSelector ) {
449448 var $otherDeeds = $deedSelector.siblings().filter( '.mwe-upwiz-deed' );
450 - this.deselectDeed( $otherDeeds );
451 - // $siblings.fadeTo( 'fast', 0.5 ) // maskSafeHide();
452 -
453 - $deedSelector
454 - .addClass('selected')
455 - .fadeTo( 'fast', 1.0 )
456 - .find( '.mwe-upwiz-deed-form' ).slideDown( 500 ); // maskSafeShow();
457 - // $deedSelector.find( 'a.mwe-upwiz-macro-deeds-return' ).show();
 449+ this.deselectDeedInterface( $otherDeeds );
 450+ $deedSelector.addClass( 'selected' ).fadeTo( 'fast', 1.0 );
 451+ $j.each( $deedSelector.find( '.mwe-upwiz-deed-form' ), function( i, form ) {
 452+ var $form = $j( form );
 453+ if ( $form.is( ':hidden' ) ) {
 454+ // if the form was hidden, set things up so a slide-down works
 455+ $form.show().slideUp( 0 );
 456+ }
 457+ $form.slideDown( 500 );
 458+ } );
458459 }
459460
460461 };

Status & tagging log