r57566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57565‎ | r57566 | r57567 >
Date:15:59, 9 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Fix LiquidThreads menus for thread permalinks
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.css
@@ -414,6 +414,10 @@
415415 margin-left: 8px;
416416 }
417417
 418+.lqt-thread-toolbar-commands > .lqt-command-history {
 419+ margin-left: 8px;
 420+}
 421+
418422 .lqt-command-quote a {
419423 background-image: url(icons/quote.png);
420424 margin-left: 8px;
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -538,7 +538,15 @@
539539 function threadCommands( $thread ) {
540540 wfLoadExtensionMessages( 'LiquidThreads' );
541541 $commands = array();
 542+
 543+ $history_url = self::permalinkUrlWithQuery( $thread, array( 'action' => 'history' ) );
 544+ $commands['history'] = array( 'label' => wfMsgExt( 'history_short', 'parseinline' ),
 545+ 'href' => $history_url,
 546+ 'enabled' => true );
542547
 548+ if ( $thread->isHistorical() ) {
 549+ return array();
 550+ }
543551 $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' );
544552 $editMsg = $user_can_edit ? 'edit' : 'viewsource';
545553
@@ -547,11 +555,6 @@
548556 true /* include fragment */ , $this->request ),
549557 'enabled' => true );
550558
551 - $history_url = self::permalinkUrlWithQuery( $thread, array( 'action' => 'history' ) );
552 - $commands['history'] = array( 'label' => wfMsgExt( 'history_short', 'parseinline' ),
553 - 'href' => $history_url,
554 - 'enabled' => true );
555 -
556559 if ( $this->user->isAllowed( 'delete' ) ) {
557560 $delete_url = $thread->title()->getFullURL( 'action=delete' );
558561 $deleteMsg = $thread->type() == Threads::TYPE_DELETED ? 'lqt_undelete' : 'delete';
@@ -590,7 +593,16 @@
591594
592595 if ( $thread->isHistorical() ) {
593596 // No links for historical threads.
594 - return array();
 597+ $history_url = self::permalinkUrlWithQuery( $thread,
 598+ array( 'action' => 'history' ) );
 599+ $commands = array();
 600+
 601+ $commands['history'] = array(
 602+ 'label' => wfMsgExt( 'history_short', 'parseinline' ),
 603+ 'href' => $history_url,
 604+ 'enabled' => true );
 605+
 606+ return $commands;
595607 }
596608
597609 $commands = array();
@@ -765,9 +777,12 @@
766778 array( 'class' => 'lqt-thread-actions-trigger ' .
767779 'lqt-command-icon', 'style' => 'display: none;' ),
768780 $triggerText );
769 - $headerParts[] = Xml::tags( 'li',
 781+
 782+ if ( count($commands) ) {
 783+ $headerParts[] = Xml::tags( 'li',
770784 array( 'class' => 'lqt-thread-toolbar-menu' ),
771785 $dropDownTrigger );
 786+ }
772787
773788 $html .= implode( ' ', $headerParts );
774789
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -370,15 +370,17 @@
371371
372372 $j(threadContainer).data( 'thread-id', threadId );
373373
374 - if (!(replyLI.length)) {
375 - return;
 374+ if ( replyLI.length ) {
 375+ replyLI[0].id = "lqt-reply-id-"+threadId;
 376+ var replyLink = replyLI.find('a');
 377+
 378+ replyLink.click( liquidThreads.handleReplyLink );
 379+
 380+ // Add quote button to menus
 381+ var toolbar = $j(threadContainer).find('.lqt-thread-toolbar-commands');
 382+ liquidThreads.addQuoteButton(toolbar);
376383 }
377384
378 - replyLI[0].id = "lqt-reply-id-"+threadId;
379 - var replyLink = replyLI.find('a');
380 -
381 - replyLink.click( liquidThreads.handleReplyLink );
382 -
383385 // Hide edit forms
384386 $j(threadContainer).find('div.lqt-edit-form').each(
385387 function() {
@@ -391,10 +393,6 @@
392394
393395 // Update menus
394396 $j(threadContainer).each( liquidThreads.setupMenus );
395 -
396 - // Add quote button to menus
397 - var toolbar = $j(threadContainer).find('.lqt-thread-toolbar-commands');
398 - liquidThreads.addQuoteButton(toolbar);
399397
400398 // Check for a "show replies" button
401399 $j('a.lqt-show-replies').click( liquidThreads.showReplies );

Follow-up revisions

RevisionCommit summaryAuthorDate
r57567Merge r57566werdna16:00, 9 October 2009

Status & tagging log