Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | myresponse: null, |
15 | 15 | showunanswered: null |
16 | 16 | }; |
17 | | - |
| 17 | + |
18 | 18 | /** |
19 | 19 | * Figure out which comment type filters have been selected. |
20 | 20 | * @return array of comment types |
— | — | @@ -538,7 +538,18 @@ |
539 | 539 | wikitext = wikitext.replace( /~{3,5}/g, '' ) + "\n\n~~~~"; // Remove and add signature for |
540 | 540 | parseWikiText( $item, wikitext ); |
541 | 541 | }); |
542 | | - } |
| 542 | + |
| 543 | + //run concurrency check |
| 544 | + $.concurrency.check( { |
| 545 | + ccaction: 'checkout', |
| 546 | + resourcetype: 'moodbar-feedback-response', |
| 547 | + record: $item.data( 'mbccontinue' ).split( '|' )[1] |
| 548 | + }, function( data ){ |
| 549 | + if( data && data.concurrency.result == 'failure' ) { //checkout failed, show tooltip |
| 550 | + loadConcurrencyToolTip($item); |
| 551 | + } |
| 552 | + } ); |
| 553 | + } |
543 | 554 | e.preventDefault(); |
544 | 555 | } |
545 | 556 | |
— | — | @@ -627,31 +638,31 @@ |
628 | 639 | /** |
629 | 640 | * Display tooltip for response concurrency notification |
630 | 641 | * @param $item Feedback item |
631 | | - */ |
632 | | - function loadToolTip( $item ) { |
633 | | - var tooltip = $( '<div>' ).attr( 'class', 'fbd-tooltip-overlay-wrap' ) |
634 | | - .append( |
635 | | - $( '<div>' ).attr( 'class', 'fbd-tooltip-overlay' ) |
636 | | - .append( |
637 | | - $( '<div>' ).attr( 'class', 'fbd-tooltip-pointy' ) |
638 | | - ).append( |
639 | | - $( '<div>' ).attr( 'class', 'fbd-tooltip-title' ) |
640 | | - .text( mw.msg( 'response-concurrency-notification' ) ) |
641 | | - .prepend( |
642 | | - $( '<span>' ).attr( 'class', 'fbd-tooltip-close' ).text( 'X' ) |
643 | | - ) |
| 642 | + */ |
| 643 | + function loadConcurrencyToolTip($item) { |
| 644 | + var $tooltip = $('<div>').attr('class', 'fbd-tooltip-overlay-wrap') |
| 645 | + .append( |
| 646 | + $('<div>').attr('class', 'fbd-tooltip-overlay') |
| 647 | + .append( |
| 648 | + $('<div>').attr('class', 'fbd-tooltip-pointy') |
| 649 | + ).append( |
| 650 | + $('<div>').attr('class', 'fbd-tooltip-title') |
| 651 | + .text( mw.msg( 'response-concurrency-notification' ) ) |
| 652 | + .prepend( |
| 653 | + $('<span>').attr('class', 'fbd-tooltip-close').text('X') |
644 | 654 | ) |
645 | | - ); |
646 | | - $item.append( tooltip ); |
| 655 | + ) |
| 656 | + ); |
| 657 | + $item.find( '.fbd-item-response' ).append( $tooltip ); |
647 | 658 | // Close event, closure remembers object |
648 | 659 | $( '.fbd-tooltip-close' ) |
649 | 660 | .live( 'click' , function () { |
650 | | - tooltip.remove(); |
651 | | - }); |
652 | | - setTimeout( function () { |
653 | | - tooltip.fadeOut(function ( tooltip ) { |
654 | | - tooltip.remove(); |
655 | | - }); |
| 661 | + $tooltip.remove(); |
| 662 | + } ); |
| 663 | + setTimeout( function() { |
| 664 | + $tooltip.fadeOut( function(){ |
| 665 | + $tooltip.remove(); |
| 666 | + } ); |
656 | 667 | }, 1500 ); |
657 | 668 | |
658 | 669 | } |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -189,6 +189,7 @@ |
190 | 190 | 'scripts' => 'ext.moodBar.dashboard/ext.moodBar.dashboard.js', |
191 | 191 | 'dependencies' => array( |
192 | 192 | 'mediawiki.util', |
| 193 | + 'jquery.concurrency', |
193 | 194 | 'user.tokens', |
194 | 195 | 'jquery.NobleCount', |
195 | 196 | 'jquery.elastic' |