r62160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62159‎ | r62160 | r62161 >
Date:02:14, 9 February 2010
Author:werdna
Status:deferred
Tags:
Comment:
Merge r62158
Modified paths:
  • /branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
@@ -70,13 +70,17 @@
7171 return repliesElement;
7272 },
7373
74 - 'checkEmptyReplies' : function( element ) {
 74+ 'checkEmptyReplies' : function( element, action ) {
7575 var contents = element.contents();
7676
7777 contents = contents.not('.lqt-replies-finish,.lqt-post-sep,.lqt-edit-form');
7878
7979 if ( !contents.length ) {
80 - element.remove();
 80+ if ( typeof action == 'undefined' || action == 'remove' ) {
 81+ element.remove();
 82+ } else {
 83+ element.hide();
 84+ }
8185 }
8286 },
8387
@@ -1234,18 +1238,23 @@
12351239
12361240 setTimeout( function() { thread.draggable('destroy'); }, 1 );
12371241
1238 - // Now, let's do our updates
1239 - liquidThreads.confirmDragDrop( thread, params );
1240 -
 1242+ // Remove drop points and schedule removal of empty replies elements.
 1243+ var emptyChecks = [];
12411244 $j('.lqt-drop-zone').each( function() {
12421245 var repliesHolder = $j(this).closest('.lqt-thread-replies');
12431246
12441247 $j(this).remove();
12451248
12461249 if (repliesHolder.length) {
1247 - liquidThreads.checkEmptyReplies(repliesHolder);
 1250+ liquidThreads.checkEmptyReplies( repliesHolder, 'hide' );
 1251+ emptyChecks = $j.merge( emptyChecks, repliesHolder );
12481252 }
12491253 } );
 1254+
 1255+ params.emptyChecks = emptyChecks;
 1256+
 1257+ // Now, let's do our updates
 1258+ liquidThreads.confirmDragDrop( thread, params );
12501259 },
12511260
12521261 'confirmDragDrop' : function( thread, params ) {
@@ -1352,6 +1361,12 @@
13531362 var topLevel = (newParent == 'top');
13541363 var wasTopLevel = thread.hasClass( 'lqt-thread-topmost' );
13551364
 1365+ var doEmptyChecks = function() {
 1366+ $j.each( params.emptyChecks, function( k, element ) {
 1367+ liquidThreads.checkEmptyReplies( $j(element) );
 1368+ } );
 1369+ };
 1370+
13561371 var doneCallback =
13571372 function(data) {
13581373 // TODO error handling
@@ -1369,6 +1384,7 @@
13701385
13711386 if (result != 'success') {
13721387 alert( "Error: "+result );
 1388+ doEmptyChecks();
13731389 return;
13741390 }
13751391
@@ -1393,7 +1409,6 @@
13941410 var heading = $j('#lqt-header-'+threadId);
13951411 }
13961412
1397 -
13981413 // Assorted ways of returning a thread to its proper place.
13991414 if ( typeof params.insertAfter != 'undefined' ) {
14001415 // Move the heading
@@ -1463,6 +1478,8 @@
14641479 if ( typeof callback == 'function' ) {
14651480 callback();
14661481 }
 1482+
 1483+ doEmptyChecks();
14671484 }
14681485
14691486 if ( !topLevel || !wasTopLevel ) {
Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
___________________________________________________________________
Name: svn:mergeinfo
14701487 + /trunk/extensions/LiquidThreads/lqt.js:57390,58990-62113,62158

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62158Defer removal of empty replies elements until after drag-and-drop procedure i...werdna02:11, 9 February 2010

Status & tagging log