Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -78,6 +78,14 @@ |
79 | 79 | $rating.find( '.articleFeedback-rating-clear' ).hide(); |
80 | 80 | } |
81 | 81 | }, |
| 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 | + }, |
82 | 90 | 'submit': function() { |
83 | 91 | var context = this; |
84 | 92 | // Lock the submit button -- TODO: lock the star inputs too |
— | — | @@ -172,12 +180,9 @@ |
173 | 181 | } |
174 | 182 | if ( $expertise.find( 'input:checkbox[value=general]:checked' ).size() ) { |
175 | 183 | $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 | + } ) |
182 | 187 | .find( '.articleFeedback-expertise-options' ) |
183 | 188 | .show(); |
184 | 189 | } |
— | — | @@ -229,6 +234,8 @@ |
230 | 235 | .end() |
231 | 236 | .find( 'input[value="' + ratingData.userrating + '"]' ) |
232 | 237 | .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' ) ); |
233 | 240 | } |
234 | 241 | $.articleFeedback.fn.updateRating.call( $(this) ); |
235 | 242 | } ); |
— | — | @@ -444,11 +451,10 @@ |
445 | 452 | .find( '.articleFeedback-submit' ) |
446 | 453 | .button( { 'disabled': false } ) |
447 | 454 | .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 | + } ); |
453 | 459 | $(this) |
454 | 460 | .closest( '.articleFeedback-rating' ) |
455 | 461 | .addClass( 'articleFeedback-rating-new' ) |