r98073 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98072‎ | r98073 | r98074 >
Date:17:59, 25 September 2011
Author:catrope
Status:ok
Tags:
Comment:
MoodBar: Display an error message when the AJAX call fails. Probably needs a better error message and/or better styling, but Brandon's not around to help me now
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.php (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -85,9 +85,10 @@
8686 'moodbar-feedback-permalink' => 'link to here',
8787 'moodbar-feedback-noresults' => 'There are no comments that match your filters.',
8888 'moodbar-feedback-more' => 'More',
89 - 'moodbar-feedback-nomore' => 'There are no more results to show',
 89+ 'moodbar-feedback-nomore' => 'There are no more results to show.',
9090 'moodbar-feedback-newer' => 'Newer',
9191 'moodbar-feedback-older' => 'Older',
 92+ 'moodbar-feedback-ajaxerror' => 'An error occurred while fetching more results.',
9293 // Mood types
9394 'moodbar-type-happy' => 'Happy',
9495 'moodbar-type-sad' => 'Sad',
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
@@ -37,8 +37,14 @@
3838 $.ajax( mw.util.wikiScript( 'api' ), {
3939 'data': reqData,
4040 'success': function( data ) {
 41+ // Remove the spinner and restore the "More" link
 42+ $( '#fbd-list-more' )
 43+ .removeClass( 'mw-ajax-loader' )
 44+ .children( 'a' )
 45+ .css( 'visibility', 'visible' );
 46+
4147 if ( !data || !data.query || !data.query.moodbarcomments ) {
42 - // TODO error
 48+ $( '#fbd-list-more' ).text( mw.msg( 'moodbar-feedback-ajaxerror' ) );
4349 return;
4450 }
4551
@@ -62,17 +68,14 @@
6369 $ul.append( comments[i].formatted );
6470 }
6571
66 - // Remove the spinner and restore the "More" link
67 - $( '#fbd-list-more' )
68 - .removeClass( 'mw-ajax-loader' )
69 - .children( 'a' )
70 - .css( 'visibility', 'visible' );
7172 if ( !moreResults ) {
7273 $( '#fbd-list-more' ).text( mw.msg( 'moodbar-feedback-nomore' ) );
7374 }
7475 },
7576 'error': function( jqXHR, textStatus, errorThrown ) {
76 - // TODO
 77+ $( '#fbd-list-more' )
 78+ .removeClass( 'mw-ajax-loader' )
 79+ .text( mw.msg( 'moodbar-feedback-ajaxerror' ) );
7780 },
7881 'dataType': 'json'
7982 } );
Index: trunk/extensions/MoodBar/MoodBar.php
@@ -119,7 +119,7 @@
120120 $wgResourceModules['ext.moodBar.dashboard'] = $mbResourceTemplate + array(
121121 'scripts' => 'ext.moodBar.dashboard/ext.moodBar.dashboard.js',
122122 'dependencies' => array( 'mediawiki.util' ),
123 - 'messages' => array( 'moodbar-feedback-nomore' ),
 123+ 'messages' => array( 'moodbar-feedback-nomore', 'moodbar-feedback-ajaxerror' ),
124124 );
125125
126126 $wgResourceModules['ext.moodBar.dashboard.styles'] = $mbResourceTemplate + array(

Status & tagging log