r108825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108824‎ | r108825 | r108826 >
Date:18:42, 13 January 2012
Author:rmoen
Status:ok (Comments)
Tags:
Comment:
in preparation of concurrencyCheck extension, add concurrency check call to feedback dashboard response items, added method to load tooltip for notification.
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
@@ -539,6 +539,21 @@
540540 wikitext = wikitext.replace( /~{3,5}/g, '' ) + "\n\n~~~~"; // Remove and add signature for
541541 parseWikiText( $item, wikitext );
542542 });
 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+
543558 }
544559 e.preventDefault();
545560 }
@@ -624,7 +639,38 @@
625640 reloadItem( $el, true );
626641 }, 2000);
627642 }
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+
629675 // On-load stuff
630676 $( '.fbd-item-show a' ).live( 'click', showHiddenItem );
631677 $( '.fbd-item-hide a' ).live( 'click', hideItem );

Follow-up revisions

RevisionCommit summaryAuthorDate
r109668add InterfaceConcurrency js module if extension is loadedrmoen00:36, 21 January 2012
r109877[MoodBar] whitespacekrinkle00:10, 24 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   19:21, 13 January 2012

Try to keep consistent whitespace.

Status & tagging log