http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70083

Revision: 70083
Author:   werdna
Date:     2010-07-28 12:14:52 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
LiquidThreads: Fix several bugs in drag-and-drop, drop large containing box in 
favour of moving header and anchor within the existing one.

Modified Paths:
--------------
    trunk/extensions/LiquidThreads/classes/View.php
    trunk/extensions/LiquidThreads/lqt.js

Modified: trunk/extensions/LiquidThreads/classes/View.php
===================================================================
--- trunk/extensions/LiquidThreads/classes/View.php     2010-07-28 12:11:46 UTC 
(rev 70082)
+++ trunk/extensions/LiquidThreads/classes/View.php     2010-07-28 12:14:52 UTC 
(rev 70083)
@@ -1893,11 +1893,6 @@
 
                $html = '';
 
-               $html .= Xml::openElement( 'div', array( 'class' => 
'lqt-thread-wrapper' ) );
-
-               $html .= Xml::element( 'a', array( 'name' => $this->anchorName( 
$thread ) ), ' ' );
-               $html .= $this->showThreadHeading( $thread );
-
                $class = $this->threadDivClass( $thread );
                if ( $levelNum == 1 ) {
                        $class .= ' lqt-thread-first';
@@ -1910,6 +1905,8 @@
                } else {
                        $class .= ' lqt-thread-no-subthreads';
                }
+               
+               $class .= ' lqt-thread-wrapper';
 
                $html .= Xml::openElement(
                        'div',
@@ -1918,6 +1915,9 @@
                                'id' => 'lqt_thread_id_' . $thread->id()
                        )
                );
+               
+               $html .= Xml::element( 'a', array( 'name' => $this->anchorName( 
$thread ) ), ' ' );
+               $html .= $this->showThreadHeading( $thread );
 
                // Metadata stuck in the top of the lqt_thread div.
                // Modified time for topmost threads...
@@ -2039,7 +2039,7 @@
 //                     }
 //             }
 
-               $this->output->addHTML( Xml::closeElement( 'div' ) . 
Xml::closeElement( 'div' ) );
+               $this->output->addHTML( Xml::closeElement( 'div' ) );
 
                $this->threadNestingLevel--;
        }

Modified: trunk/extensions/LiquidThreads/lqt.js
===================================================================
--- trunk/extensions/LiquidThreads/lqt.js       2010-07-28 12:11:46 UTC (rev 
70082)
+++ trunk/extensions/LiquidThreads/lqt.js       2010-07-28 12:14:52 UTC (rev 
70083)
@@ -567,15 +567,15 @@
                                thread.append( newThreadContent );
                                thread.attr( 'class', newThread.attr('class') );
 
-                               // Replace header content
-                               var newHeader = 
newContent.filter('#lqt-header-'+threadId);
-                               if ( header.length ) {
-                                       var newHeaderContent = 
$j(newHeader).contents();
-                                       header.append( newHeaderContent );
-                               } else {
-                                       // No existing header, add one before 
the thread
-                                       thread.before(newHeader);
-                               }
+// Replace header content
+//                             var newHeader = 
newContent.filter('#lqt-header-'+threadId);
+//                             if ( header.length ) {
+//                                     var newHeaderContent = 
$j(newHeader).contents();
+//                                     header.append( newHeaderContent );
+//                             } else {
+//                                     // No existing header, add one before 
the thread
+//                                     thread.before(newHeader);
+//                             }
 
                                // Set up thread.
                                thread.find('.lqt-post-wrapper').each( 
function() {
@@ -872,7 +872,7 @@
                var replyCallback = function( data ) {
                        $parent = $j( '#lqt_thread_id_' + 
data.threadaction.thread['parent-id'] );
                        $html = $j( data.threadaction.thread['html'] );
-                       $newThread = $html.find( '#lqt_thread_id_' + 
data.threadaction.thread['thread-id'] ).parent();
+                       $newThread = $html.find( '#lqt_thread_id_' + 
data.threadaction.thread['thread-id'] );
                        $parent.find( '.lqt-thread-replies:first' ).append( 
$newThread );
                        liquidThreads.setupThread( $newThread.find( 
'.lqt-post-wrapper' ) );
                        $j( 'html,body' ).animate({scrollTop: 
$newThread.offset().top}, 'slow');
@@ -1153,10 +1153,8 @@
                var firstDropZone = createDropZone();
                firstDropZone.data( 'sortkey', 'now' );
                firstDropZone.data( 'parent', 'top' );
-               var firstThread = $j('.lqt-thread-topmost.lqt-thread-first');
-               var firstThreadID = 
firstThread.find('.lqt-post-wrapper').data('thread-id');
-               var firstHeading = $j('#lqt-header-'+firstThreadID);
-               firstHeading.before(firstDropZone);
+               var firstThread = $j('.lqt-thread-topmost:first');
+               firstThread.before(firstDropZone);
 
                // Now one after every thread
                $j('.lqt-thread-topmost').each( function() {
@@ -1171,7 +1169,7 @@
                } );
 
                // Now one underneath every thread
-               $j('.lqt_thread').each( function() {
+               $j('.lqt_thread').not(thread).each( function() {
                        var thread = $j(this);
                        var repliesElement = liquidThreads.getRepliesElement( 
thread );
                        var dropZone = createDropZone();
@@ -1392,44 +1390,17 @@
                                // Do the actual physical movement
                                var threadId = thread.find('.lqt-post-wrapper')
                                                .data('thread-id');
-                               var topmost = 
thread.hasClass('lqt-thread-topmost');
 
-                               if ( topmost ) {
-                                       var heading = 
$j('#lqt-header-'+threadId);
-                               }
-
                                // Assorted ways of returning a thread to its 
proper place.
                                if ( typeof params.insertAfter != 'undefined' ) 
{
-                                       // Move the heading
-                                       if ( topmost ) {
-                                               heading.remove();
-                                               
params.insertAfter.after(heading);
-                                               thread.remove();
-                                               heading.after( thread );
-                                       } else {
-                                               thread.remove();
-                                               
params.insertAfter.after(thread);
-                                       }
+                                       thread.remove();
+                                       params.insertAfter.after(thread);
                                } else if ( typeof params.insertBefore != 
'undefined' ) {
-                                       if ( topmost ) {
-                                               heading.remove();
-                                               
params.insertBefore.before(heading);
-                                               thread.remove();
-                                               heading.after( thread );
-                                       } else {
-                                               thread.remove();
-                                               params.insertBefore.before( 
thread );
-                                       }
+                                       thread.remove();
+                                       params.insertBefore.before( thread );
                                } else if ( typeof params.insertUnder != 
'undefined' ) {
-                                       if ( topmost ) {
-                                               heading.remove();
-                                               
params.insertUnder.prepend(heading);
-                                               thread.remove();
-                                               heading.after(thread);
-                                       } else {
-                                               thread.remove();
-                                               
params.insertUnder.prepend(thread);
-                                       }
+                                       thread.remove();
+                                       params.insertUnder.prepend(thread);
                                }
 
                                thread.data('thread-id', threadId);
@@ -1455,8 +1426,8 @@
                                }
 
                                // Kill the heading, if there isn't one.
-                               if ( !topLevel && wasTopLevel && heading.length 
) {
-                                       heading.remove();
+                               if ( !topLevel && wasTopLevel ) {
+                                       thread.find('h2.lqt_header').remove();
                                }
 
                                if ( !wasTopLevel && typeof oldParent != 
'undefined' ) {



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to