Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -539,6 +539,21 @@ |
540 | 540 | wikitext = wikitext.replace( /~{3,5}/g, '' ) + "\n\n~~~~"; // Remove and add signature for |
541 | 541 | parseWikiText( $item, wikitext ); |
542 | 542 | }); |
| 543 | + |
| 544 | + //check for concurrency module. |
| 545 | + if( typeof $.concurrency !== 'undefined') { |
| 546 | + //concurrency module is here, attempt checkout |
| 547 | + $.concurrency.check( { |
| 548 | + ccaction: 'checkout', |
| 549 | + resourcetype: 'moodbar-feedback-response', |
| 550 | + record: $item.data( 'mbccontinue' ).split( '|' )[1] |
| 551 | + }, function( result ){ |
| 552 | + if( result == 'failure' ) { //checkout failed, show tooltip |
| 553 | + loadConcurrencyToolTip($item); |
| 554 | + } |
| 555 | + } ); |
| 556 | + } |
| 557 | + |
543 | 558 | } |
544 | 559 | e.preventDefault(); |
545 | 560 | } |
— | — | @@ -624,7 +639,38 @@ |
625 | 640 | reloadItem( $el, true ); |
626 | 641 | }, 2000); |
627 | 642 | } |
628 | | - |
| 643 | + |
| 644 | + /** |
| 645 | + * Display tooltip for response concurrency notification |
| 646 | + * @param $item Feedback item |
| 647 | + */ |
| 648 | + function loadConcurrencyToolTip($item) { |
| 649 | + var $tooltip = $('<div>').attr('class', 'fbd-tooltip-overlay-wrap') |
| 650 | + .append( |
| 651 | + $('<div>').attr('class', 'fbd-tooltip-overlay') |
| 652 | + .append( |
| 653 | + $('<div>').attr('class', 'fbd-tooltip-pointy') |
| 654 | + ).append( |
| 655 | + $('<div>').attr('class', 'fbd-tooltip-title') |
| 656 | + .text( mw.msg( 'response-concurrency-notification' ) ) |
| 657 | + .prepend( |
| 658 | + $('<span>').attr('class', 'fbd-tooltip-close').text('X') |
| 659 | + ) |
| 660 | + ) |
| 661 | + ); |
| 662 | + $item.find( '.fbd-item-response' ).append( $tooltip ); |
| 663 | + // Close event, closure remembers object |
| 664 | + $( '.fbd-tooltip-close' ) |
| 665 | + .live( 'click' , function () { |
| 666 | + $tooltip.remove(); |
| 667 | + } ); |
| 668 | + setTimeout( function() { |
| 669 | + $tooltip.fadeOut( function(){ |
| 670 | + $tooltip.remove(); |
| 671 | + } ); |
| 672 | + }, 1500 ); |
| 673 | + } |
| 674 | + |
629 | 675 | // On-load stuff |
630 | 676 | $( '.fbd-item-show a' ).live( 'click', showHiddenItem ); |
631 | 677 | $( '.fbd-item-hide a' ).live( 'click', hideItem ); |