Bene has uploaded a new change for review. https://gerrit.wikimedia.org/r/219953
Change subject: Insert empty toc to help MobileFrontend ...................................................................... Insert empty toc to help MobileFrontend MobileFrontend looks for an element with id #toc to place its toc. Otherwise the toc gets added after the first element, which is the bottom of the page on Wikidata as we have one wrapping div. Bug: T95884 Change-Id: Ifcc650eb9931f85aae14adec537700a7d0a4624e --- M view/resources/templates.php M view/src/EntityView.php M view/tests/phpunit/EntityViewTest.php 3 files changed, 12 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/53/219953/1 diff --git a/view/resources/templates.php b/view/resources/templates.php index 21773b0..15bd497 100644 --- a/view/resources/templates.php +++ b/view/resources/templates.php @@ -43,6 +43,12 @@ <h2 class="wb-section-heading section-heading $3" dir="auto"><span id="$2">$1</span></h2> HTML; + // empty toc to help MobileFrontend + $templates['wikibase-toc'] = +<<<HTML +<div id="toc"></div> +HTML; + $templates['wikibase-statementgrouplistview'] = <<<HTML <div class="wikibase-statementgrouplistview"><!-- wikibase-listview -->$1</div> diff --git a/view/src/EntityView.php b/view/src/EntityView.php index dc94642..1aa0959 100644 --- a/view/src/EntityView.php +++ b/view/src/EntityView.php @@ -162,10 +162,14 @@ protected function getMainHtml( EntityRevision $entityRevision ) { $entity = $entityRevision->getEntity(); - return $this->getHtmlForFingerprint( + $html = $this->getHtmlForFingerprint( $entity, $this->getHtmlForTermBox( $entityRevision ) ); + + $html .= $this->templateFactory->render( 'wikibase-toc' ); + + return $html; } /** diff --git a/view/tests/phpunit/EntityViewTest.php b/view/tests/phpunit/EntityViewTest.php index 21836df..dc11bca 100644 --- a/view/tests/phpunit/EntityViewTest.php +++ b/view/tests/phpunit/EntityViewTest.php @@ -68,6 +68,7 @@ $entityId = $entityRevision->getEntity()->getId()->getSerialization(); $this->assertRegExp( '/id="wb-[a-z]+-' . $entityId . '"/', $output ); + $this->assertContains( '<div id="toc"></div>', $output ); } public abstract function provideTestGetHtml(); -- To view, visit https://gerrit.wikimedia.org/r/219953 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifcc650eb9931f85aae14adec537700a7d0a4624e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Bene <benestar.wikime...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits