r105708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105707‎ | r105708 | r105709 >
Date:20:32, 9 December 2011
Author:rsterbin
Status:ok
Tags:
Comment:
Fixed the showstopper error:
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js:
- New template errorPanel
- Removed unused template dialogInner
- Updated loadForm() to append the error wrapper after the panel
- Updated markShowstopperError() to:
- Distinguish between dialog and panel modes
- Remove the form from the page entirely after showing the error
- Drop the top-to-offset hack, as wrapping the panel in a div with
position:relative puts it in the right place
- Remove any feedback links
- For dialogs, strip out the title and change the close trigger to
clear the panel as well
- Set nowShowing to none
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css:
- Made the error wrapper position:relative
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css
@@ -26,6 +26,10 @@
2727 text-align: center;
2828 }
2929
 30+.articleFeedbackv5-error-wrap {
 31+ position: relative;
 32+}
 33+
3034 .articleFeedbackv5-error {
3135 display: none;
3236 position: absolute;
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -174,17 +174,13 @@
175175 </div>\
176176 </div>\
177177 </div>\
178 - <div class="articleFeedbackv5-error"><div class="articleFeedbackv5-error-message"></div></div>\
179 - <div style="clear:both;"></div>\
180178 </div>\
181179 ',
182180
183 - dialogInner: '\
184 - <div class="articleFeedbackv5-dialog-inner">\
185 - <div class="articleFeedbackv5-buffer">\
 181+ errorPanel: '<div class="articleFeedbackv5-error-wrap">\
 182+ <div class="articleFeedbackv5-error">\
 183+ <div class="articleFeedbackv5-error-message"></div>\
186184 </div>\
187 - <div class="articleFeedbackv5-error"><div class="articleFeedbackv5-error-message"></div></div>\
188 - <div style="clear:both;"></div>\
189185 </div>\
190186 ',
191187
@@ -2137,6 +2133,7 @@
21382134 // Add it to the page
21392135 $.articleFeedbackv5.$holder
21402136 .html( $wrapper )
 2137+ .append( $( $.articleFeedbackv5.templates.errorPanel ) )
21412138 .append( '<div class="articleFeedbackv5-lock"></div>' );
21422139
21432140 // Add an empty dialog
@@ -2343,19 +2340,33 @@
23442341 */
23452342 $.articleFeedbackv5.markShowstopperError = function ( message ) {
23462343 aft5_debug( message );
2347 - var $err = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' );
 2344+ if ( $.articleFeedbackv5.inDialog ) {
 2345+ $.articleFeedbackv5.$dialog.dialog( 'option', 'title', '' );
 2346+ $.articleFeedbackv5.$dialog.dialog( 'option', 'close', function () {
 2347+ $.articleFeedbackv5.clear();
 2348+ } );
 2349+ $.articleFeedbackv5.$dialog.find( '.articleFeedbackv5-ui' ).remove();
 2350+ $( '#ui-dialog-title-articleFeedbackv5-dialog-wrap' ).parent()
 2351+ .find( '.articleFeedbackv5-tooltip-trigger' ).remove();
 2352+ $.articleFeedbackv5.$dialog.append( $( '<div class="articleFeedbackv5-error-message"></div>' ) );
 2353+ $.articleFeedbackv5.find( '.articleFeedbackv5-error' ).show();
 2354+ } else {
 2355+ var $veil = $.articleFeedbackv5.find( '.articleFeedbackv5-error' );
 2356+ var $box = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-panel' );
 2357+ $veil.css( 'top', '-' + $box.height() );
 2358+ $veil.css( 'width', $box.width() );
 2359+ $veil.css( 'height', $box.height() );
 2360+ $veil.show();
 2361+ $box.css( 'width', $box.width() );
 2362+ $box.css( 'height', $box.height() );
 2363+ $box.html( '' );
 2364+ }
 2365+ var $err = $.articleFeedbackv5.find( '.articleFeedbackv5-error-message' );
23482366 $err.text( $.articleFeedbackv5.debug && message ? message : mw.msg( 'articlefeedbackv5-error' ) );
23492367 $err.html( $err.html().replace( "\n", '<br />' ) );
2350 - var $veil = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' );
2351 - var $box = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-buffer' );
2352 - // TODO: Make this smarter -- on ubuntu/ff at least, using the
2353 - // offset puts it about 100px down from where it should be;
2354 - // this math corrects for it, but will most likely be wrong on
2355 - // other browsers
2356 - $veil.css('top', $box.find('.articleFeedbackv5-ui').offset().top / 2 + 10);
2357 - $veil.css('width', $box.width());
2358 - $veil.css('height', $box.height());
2359 - $veil.show();
 2368+ $.articleFeedbackv5.$toRemove.remove();
 2369+ $.articleFeedbackv5.$toRemove = $( [] );
 2370+ $.articleFeedbackv5.nowShowing = 'none';
23602371 };
23612372
23622373 // }}}

Status & tagging log