Rely on core TOC data to show the TOC in Vector

Bug: T298796
Depends-on: I406acf333d28b3898e3bc4968d05224febd09b3c
Change-Id: Iebb9c86b409a49d211c320f540b9af409b604b5b
This commit is contained in:
bwang 2022-01-24 16:44:11 -06:00
parent 26835ad0ce
commit d244f43e39
2 changed files with 10 additions and 9 deletions

View file

@ -583,6 +583,7 @@ class SkinVector extends SkinMustache {
$out = $skin->getOutput(); $out = $skin->getOutput();
$title = $out->getTitle(); $title = $out->getTitle();
$parentData = parent::getTemplateData(); $parentData = parent::getTemplateData();
$featureManager = VectorServices::getFeatureManager();
// Naming conventions for Mustache parameters. // Naming conventions for Mustache parameters.
// //
@ -600,7 +601,6 @@ class SkinVector extends SkinMustache {
// It should be followed by the name of the hook in hyphenated lowercase. // It should be followed by the name of the hook in hyphenated lowercase.
// //
// Conditionally used values must use null to indicate absence (not false or ''). // Conditionally used values must use null to indicate absence (not false or '').
$commonSkinData = array_merge( $parentData, [ $commonSkinData = array_merge( $parentData, [
'is-legacy' => $this->isLegacy(), 'is-legacy' => $this->isLegacy(),
@ -611,9 +611,6 @@ class SkinVector extends SkinMustache {
'is-language-in-content' => $this->isLanguagesInContent(), 'is-language-in-content' => $this->isLanguagesInContent(),
'is-language-in-content-top' => $this->isLanguagesInContentAt( 'top' ), 'is-language-in-content-top' => $this->isLanguagesInContentAt( 'top' ),
'is-language-in-content-bottom' => $this->isLanguagesInContentAt( 'bottom' ), 'is-language-in-content-bottom' => $this->isLanguagesInContentAt( 'bottom' ),
'is-vector-table-of-contents-visible' => $this->isTableOfContentsVisibleInSidebar(),
'data-search-box' => $this->getSearchData( 'data-search-box' => $this->getSearchData(
$parentData['data-search-box'], $parentData['data-search-box'],
!$this->isLegacy(), !$this->isLegacy(),
@ -622,7 +619,7 @@ class SkinVector extends SkinMustache {
'searchform', 'searchform',
true true
), ),
'data-vector-sticky-header' => VectorServices::getFeatureManager()->isFeatureEnabled( 'data-vector-sticky-header' => $featureManager->isFeatureEnabled(
Constants::FEATURE_STICKY_HEADER Constants::FEATURE_STICKY_HEADER
) ? $this->getStickyHeaderData( ) ? $this->getStickyHeaderData(
$this->getSearchData( $this->getSearchData(
@ -633,12 +630,16 @@ class SkinVector extends SkinMustache {
'vector-sticky-search-form', 'vector-sticky-search-form',
false false
), ),
VectorServices::getFeatureManager()->isFeatureEnabled( $featureManager->isFeatureEnabled(
Constants::FEATURE_STICKY_HEADER_EDIT Constants::FEATURE_STICKY_HEADER_EDIT
) )
) : false, ) : false,
] ); ] );
if ( !$this->isTableOfContentsVisibleInSidebar() ) {
unset( $commonSkinData['data-toc'] );
}
if ( $skin->getUser()->isRegistered() ) { if ( $skin->getUser()->isRegistered() ) {
// Note: This data is also passed to legacy template where it is unused. // Note: This data is also passed to legacy template where it is unused.
$optOutUrl = [ $optOutUrl = [

View file

@ -34,7 +34,7 @@
}} }}
<div class="mw-page-container"> <div class="mw-page-container">
<a class="mw-jump-link" href="#content">{{msg-vector-jumptocontent}}</a> <a class="mw-jump-link" href="#content">{{msg-vector-jumptocontent}}</a>
<div class="mw-page-container-inner {{#is-vector-table-of-contents-visible}} vector-toc-visible{{/is-vector-table-of-contents-visible}}"> <div class="mw-page-container-inner {{#data-toc}} vector-toc-visible{{/data-toc}}">
<input <input
type="checkbox" type="checkbox"
@ -46,9 +46,9 @@
<div class="mw-workspace-container"> <div class="mw-workspace-container">
{{>Navigation}} {{>Navigation}}
{{#is-vector-table-of-contents-visible}} {{#data-toc}}
{{>TableOfContents}} {{>TableOfContents}}
{{/is-vector-table-of-contents-visible}} {{/data-toc}}
<div class="mw-content-container"> <div class="mw-content-container">
{{! `role` is unnecessary but kept to support selectors in any gadgets or user styles. }} {{! `role` is unnecessary but kept to support selectors in any gadgets or user styles. }}
<main id="content" class="mw-body" role="main"> <main id="content" class="mw-body" role="main">