r81315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81314‎ | r81315 | r81316 >
Date:19:27, 1 February 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Improved the logic of enabling the expertise controls so that they are enabled when a user loads the tool and already has at least one rating.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -78,6 +78,14 @@
7979 $rating.find( '.articleFeedback-rating-clear' ).hide();
8080 }
8181 },
 82+ 'enableExpertise': function( $expertise ) {
 83+ $expertise
 84+ .find( 'input:checkbox[value=general]' )
 85+ .attr( 'disabled', false )
 86+ .end()
 87+ .find( '.articleFeedback-expertise-disabled' )
 88+ .removeClass( 'articleFeedback-expertise-disabled' );
 89+ },
8290 'submit': function() {
8391 var context = this;
8492 // Lock the submit button -- TODO: lock the star inputs too
@@ -172,12 +180,9 @@
173181 }
174182 if ( $expertise.find( 'input:checkbox[value=general]:checked' ).size() ) {
175183 $expertise
176 - .find( 'input:checkbox[value=general]' )
177 - .attr( 'disabled', false )
178 - .end()
179 - .find( '.articleFeedback-expertise-disabled' )
180 - .removeClass( 'articleFeedback-expertise-disabled' )
181 - .end()
 184+ .each( function() {
 185+ $.articleFeedback.fn.enableExpertise( $(this) );
 186+ } )
182187 .find( '.articleFeedback-expertise-options' )
183188 .show();
184189 }
@@ -229,6 +234,8 @@
230235 .end()
231236 .find( 'input[value="' + ratingData.userrating + '"]' )
232237 .attr( 'checked', true );
 238+ // If any ratings exist, make sure expertise is enabled so users can suppliment their ratings.
 239+ $.articleFeedback.fn.enableExpertise( context.$ui.find( '.articleFeedback-expertise' ) );
233240 }
234241 $.articleFeedback.fn.updateRating.call( $(this) );
235242 } );
@@ -444,11 +451,10 @@
445452 .find( '.articleFeedback-submit' )
446453 .button( { 'disabled': false } )
447454 .end()
448 - .find( '.articleFeedback-expertise input:checkbox[value=general]' )
449 - .attr( 'disabled', false )
450 - .end()
451 - .find( '.articleFeedback-expertise-disabled' )
452 - .removeClass( 'articleFeedback-expertise-disabled' );
 455+ .find( '.articleFeedback-expertise' )
 456+ .each( function() {
 457+ $.articleFeedback.fn.enableExpertise( $(this) );
 458+ } );
453459 $(this)
454460 .closest( '.articleFeedback-rating' )
455461 .addClass( 'articleFeedback-rating-new' )

Status & tagging log