Isarra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318462

Change subject: Only show ToC for hubs if the hubs have content
......................................................................

Only show ToC for hubs if the hubs have content

Also added a couple of visualclears, except not because apparently not all
skins actually use visualclears.

Bug: T149032
Change-Id: Id9f71c0b6a1b0812160d21a81438ff17aa0f5630
---
M CollaborationKit.hooks.php
M includes/content/CollaborationHubContent.php
2 files changed, 14 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/62/318462/1

diff --git a/CollaborationKit.hooks.php b/CollaborationKit.hooks.php
index d89ce7b..a1e16e1 100644
--- a/CollaborationKit.hooks.php
+++ b/CollaborationKit.hooks.php
@@ -97,6 +97,7 @@
 
                if ( $parentHub
                        && $out->getProperty( 'CollaborationHubSubpage' ) === 
'in-progress'
+                       && count( Revision::newFromTitle( $parentHub 
)->getContent()->getContent() ) > 0
                ) {
                        $toc = new CollaborationHubTOC();
                        $out->prependHtml( $toc->renderSubpageToC( $parentHub ) 
);
diff --git a/includes/content/CollaborationHubContent.php 
b/includes/content/CollaborationHubContent.php
index 0a93742..51ef591 100644
--- a/includes/content/CollaborationHubContent.php
+++ b/includes/content/CollaborationHubContent.php
@@ -248,17 +248,25 @@
                                $this->getParsedAnnouncements( $title, $options 
)
                        );
                        // get table of contents
-                       $html .= Html::rawElement(
-                               'div',
-                               [ 'class' => 'wp-toc' ],
-                               $this->getTableOfContents( $title, $options )
-                       );
+                       if ( count( $this->getContent() ) > 0 ) {
+                               $html .= Html::rawElement(
+                                       'div',
+                                       [ 'class' => 'wp-toc' ],
+                                       $this->getTableOfContents( $title, 
$options )
+                               );
+                       }
+
+                       $html .= Html::element( 'div', [ 'style' => 
'clear:both' ] );
+
                        // get transcluded content
                        $html .= Html::rawElement(
                                'div',
                                [ 'class' => 'wp-content' ],
                                $this->getParsedContent( $title, $options, 
$output )
                        );
+
+                       $html .= Html::element( 'div', [ 'style' => 
'clear:both' ] );
+
                        // get footer
                        $html .= Html::rawElement(
                                'div',

-- 
To view, visit https://gerrit.wikimedia.org/r/318462
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9f71c0b6a1b0812160d21a81438ff17aa0f5630
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>

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

Reply via email to