r109269 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109268‎ | r109269 | r109270 >
Date:00:46, 18 January 2012
Author:rmoen
Status:ok
Tags:
Comment:
Added better InterfaceConcurrency tooltip ui handling for feedback dashboard responses. only showing concurrency notice once for each item.
Modified paths:
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
@@ -2,7 +2,7 @@
33 * AJAX code for Special:MoodBarFeedback
44 */
55 jQuery( document ).ready( function ( $ ) {
6 - var formState, filterType, $fbdFiltersCheck;
 6+ var formState, filterType, $fbdFiltersCheck, concurrencyState = [];
77
88 /**
99 * Saved form state
@@ -413,7 +413,8 @@
414414 $( '.fbd-response-preview, .fbd-response-submit' ).removeProp( 'disabled' );
415415 $( this ).find( '.fbd-response-form' ).remove();
416416 }
417 -
 417+ //remove ConcurrencyToolTip if any
 418+ $( this ).find( '.fbd-tooltip-overlay-wrap').remove();
418419 });
419420 }
420421
@@ -423,7 +424,7 @@
424425 * @param e {jQuery.Event}
425426 */
426427 function showResponseForm( e ) {
427 - var termsLink, ula, inlineForm, $item;
 428+ var termsLink, ula, inlineForm, $item, itemId;
428429
429430 if ( $(this).hasClass( 'responder-expanded' ) ) {
430431
@@ -542,13 +543,16 @@
543544
544545 //check for concurrency module.
545546 if( typeof $.concurrency !== 'undefined') {
 547+ itemId = $item.data( 'mbccontinue' ).split( '|' )[1];
546548 //concurrency module is here, attempt checkout
547549 $.concurrency.check( {
548550 ccaction: 'checkout',
549551 resourcetype: 'moodbar-feedback-response',
550 - record: $item.data( 'mbccontinue' ).split( '|' )[1]
 552+ record: itemId
551553 }, function( result ){
552 - if( result == 'failure' ) { //checkout failed, show tooltip
 554+ //if checkout failed, show tooltip if it hasn't been shown
 555+ if( result == 'failure' && $.inArray( itemId, concurrencyState ) === -1 ) {
 556+ concurrencyState.push(itemId);
553557 loadConcurrencyToolTip($item);
554558 }
555559 } );

Status & tagging log