mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-12 01:09:20 +00:00
remove Page Tools config & HTML
Removes the config option for Page Tool menu, its associated logic, along with the associated HTML from the mustache templates. Hardcodes the `vector-feature-page-tools-enabled` class into the HTML element to prevent breakage. Bug: T332090 Change-Id: I6466d80c6970bcc8e28d897b6bdff911a90e3655
This commit is contained in:
parent
55a3d8cd8e
commit
40bbb8c3a9
|
@ -51,15 +51,13 @@ class VectorComponentMainMenu implements VectorComponent {
|
|||
$this->localizer = $localizer;
|
||||
$this->isPinned = $featureManager->isFeatureEnabled( Constants::FEATURE_MAIN_MENU_PINNED );
|
||||
|
||||
$isPageToolsEnabled = $featureManager->isFeatureEnabled( Constants::FEATURE_PAGE_TOOLS );
|
||||
if ( $isPageToolsEnabled ) {
|
||||
$this->pinnableHeader = new VectorComponentPinnableHeader(
|
||||
$this->localizer,
|
||||
$this->isPinned,
|
||||
self::ID,
|
||||
'main-menu-pinned'
|
||||
);
|
||||
}
|
||||
$this->pinnableHeader = new VectorComponentPinnableHeader(
|
||||
$this->localizer,
|
||||
$this->isPinned,
|
||||
self::ID,
|
||||
'main-menu-pinned'
|
||||
);
|
||||
|
||||
if ( $user->isRegistered() ) {
|
||||
$this->optOut = new VectorComponentMainMenuActionOptOut( $skin );
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ namespace MediaWiki\Skins\Vector\Components;
|
|||
|
||||
use Linker;
|
||||
use MediaWiki\Skin\SkinComponentLink;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use MediaWiki\Skins\Vector\VectorServices;
|
||||
use Message;
|
||||
use MessageLocalizer;
|
||||
use Title;
|
||||
|
@ -64,9 +62,7 @@ class VectorComponentUserLinks implements VectorComponent {
|
|||
$isAnon = !$user->isRegistered();
|
||||
|
||||
$class = 'vector-user-menu';
|
||||
if ( VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_PAGE_TOOLS ) ) {
|
||||
$class .= ' mw-ui-icon-flush-right';
|
||||
}
|
||||
$class .= ' mw-ui-icon-flush-right';
|
||||
$class .= !$isAnon ?
|
||||
' vector-user-menu-logged-in' :
|
||||
' vector-user-menu-logged-out';
|
||||
|
|
|
@ -190,21 +190,6 @@ final class Constants {
|
|||
*/
|
||||
public const WEB_AB_TEST_ARTICLE_ID_FACTORY_SERVICE = 'WikimediaEvents.WebABTestArticleIdFactory';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CONFIG_PAGE_TOOLS = 'VectorPageTools';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const REQUIREMENT_PAGE_TOOLS = 'PageTools';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const FEATURE_PAGE_TOOLS = 'PageTools';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
|
@ -168,26 +168,6 @@ return [
|
|||
]
|
||||
);
|
||||
|
||||
// Feature: Page tools menu
|
||||
// ================================
|
||||
$featureManager->registerRequirement(
|
||||
new OverridableConfigRequirement(
|
||||
$services->getMainConfig(),
|
||||
$context->getUser(),
|
||||
$context->getRequest(),
|
||||
null,
|
||||
Constants::CONFIG_PAGE_TOOLS,
|
||||
Constants::REQUIREMENT_PAGE_TOOLS
|
||||
)
|
||||
);
|
||||
$featureManager->registerFeature(
|
||||
Constants::FEATURE_PAGE_TOOLS,
|
||||
[
|
||||
Constants::REQUIREMENT_FULLY_INITIALISED,
|
||||
Constants::REQUIREMENT_PAGE_TOOLS,
|
||||
]
|
||||
);
|
||||
|
||||
// Feature: Page tools pinned
|
||||
// ================================
|
||||
$featureManager->registerRequirement(
|
||||
|
@ -212,7 +192,6 @@ return [
|
|||
[
|
||||
Constants::REQUIREMENT_FULLY_INITIALISED,
|
||||
Constants::REQUIREMENT_LOGGED_IN,
|
||||
Constants::REQUIREMENT_PAGE_TOOLS,
|
||||
Constants::REQUIREMENT_PAGE_TOOLS_PINNED
|
||||
]
|
||||
);
|
||||
|
@ -254,7 +233,6 @@ return [
|
|||
[
|
||||
Constants::REQUIREMENT_FULLY_INITIALISED,
|
||||
Constants::REQUIREMENT_LOGGED_IN,
|
||||
Constants::REQUIREMENT_PAGE_TOOLS,
|
||||
Constants::REQUIREMENT_MAIN_MENU_PINNED
|
||||
]
|
||||
);
|
||||
|
|
|
@ -219,6 +219,11 @@ class SkinVector22 extends SkinMustache {
|
|||
$featureManager = VectorServices::getFeatureManager();
|
||||
$original['class'] .= ' ' . implode( ' ', $featureManager->getFeatureBodyClass() );
|
||||
|
||||
// FIXME: Added as a temporary workaround for
|
||||
// https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/903849
|
||||
// Must be removed once Page Tools cleanup is finished.
|
||||
$original['class'] .= ' vector-feature-page-tools-enabled ';
|
||||
|
||||
if ( VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_STICKY_HEADER ) ) {
|
||||
// T290518: Add scroll padding to root element when the sticky header is
|
||||
// enabled. This class needs to be server rendered instead of added from
|
||||
|
@ -326,12 +331,9 @@ class SkinVector22 extends SkinMustache {
|
|||
$langData = $parentData['data-portlets']['data-languages'] ?? null;
|
||||
$config = $this->getConfig();
|
||||
|
||||
$isPageToolsEnabled = $featureManager->isFeatureEnabled( Constants::FEATURE_PAGE_TOOLS );
|
||||
$sidebar = $parentData[ 'data-portlets-sidebar' ];
|
||||
$pageToolsMenu = [];
|
||||
if ( $isPageToolsEnabled ) {
|
||||
self::extractPageToolsFromSidebar( $sidebar, $pageToolsMenu );
|
||||
}
|
||||
self::extractPageToolsFromSidebar( $sidebar, $pageToolsMenu );
|
||||
|
||||
$hasAddTopicButton = $config->get( 'VectorPromoteAddTopic' ) &&
|
||||
$this->removeAddTopicButton( $parentData );
|
||||
|
@ -448,17 +450,17 @@ class SkinVector22 extends SkinMustache {
|
|||
VectorComponentMainMenu::ID . '-dropdown' . ' mw-ui-icon-flush-left mw-ui-icon-flush-right',
|
||||
'menu'
|
||||
),
|
||||
'data-page-tools' => $isPageToolsEnabled ? new VectorComponentPageTools(
|
||||
'data-page-tools' => new VectorComponentPageTools(
|
||||
array_merge( [ $parentData['data-portlets']['data-actions'] ?? [] ], $pageToolsMenu ),
|
||||
$localizer,
|
||||
$this->getUser(),
|
||||
$featureManager
|
||||
) : null,
|
||||
'data-page-tools-dropdown' => $isPageToolsEnabled ? new VectorComponentDropdown(
|
||||
),
|
||||
'data-page-tools-dropdown' => new VectorComponentDropdown(
|
||||
VectorComponentPageTools::ID . '-dropdown',
|
||||
$this->msg( 'toolbox' )->text(),
|
||||
VectorComponentPageTools::ID . '-dropdown',
|
||||
) : null,
|
||||
),
|
||||
'data-vector-sticky-header' => $featureManager->isFeatureEnabled(
|
||||
Constants::FEATURE_STICKY_HEADER
|
||||
) ? new VectorComponentStickyHeader(
|
||||
|
@ -493,8 +495,7 @@ class SkinVector22 extends SkinMustache {
|
|||
'is-language-in-content-bottom' => $this->isLanguagesInContentAt( 'bottom' ),
|
||||
'is-main-menu-visible' => $this->isMainMenuVisible(),
|
||||
// Cast empty string to null
|
||||
'html-subtitle' => $parentData['html-subtitle'] === '' ? null : $parentData['html-subtitle'],
|
||||
'is-page-tools-enabled' => $isPageToolsEnabled
|
||||
'html-subtitle' => $parentData['html-subtitle'] === '' ? null : $parentData['html-subtitle']
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<header class="mw-header{{^is-page-tools-enabled}} mw-ui-icon-flush-left mw-ui-icon-flush-right{{/is-page-tools-enabled}}">
|
||||
<header class="mw-header">
|
||||
<div class="vector-header-start">
|
||||
{{^is-page-tools-enabled}}
|
||||
{{>deprecated/MainMenuBtn}}
|
||||
{{/is-page-tools-enabled}}
|
||||
{{#is-page-tools-enabled}}
|
||||
<nav class="vector-main-menu-landmark" aria-label="{{msg-vector-site-nav-label}}" role="navigation">
|
||||
{{>MainMenuDropdown}}
|
||||
</nav>
|
||||
{{/is-page-tools-enabled}}
|
||||
<nav class="vector-main-menu-landmark" aria-label="{{msg-vector-site-nav-label}}" role="navigation">
|
||||
{{>MainMenuDropdown}}
|
||||
</nav>
|
||||
{{#data-logos}}{{>Logo}}{{/data-logos}}
|
||||
</div>
|
||||
<div class="vector-header-end">
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{{! Use .mw-portlet-cactions to style }}
|
||||
{{>Dropdown/Open}}
|
||||
{{>MenuContents}}
|
||||
{{>Dropdown/Close}}
|
|
@ -1,17 +1,5 @@
|
|||
{{! Use `.vector-main-menu` to target styles at this element}}
|
||||
{{>PinnableElement/Open}}
|
||||
{{^is-page-tools-enabled}}
|
||||
{{#data-portlets-first}}{{>MainMenuGroup}}{{/data-portlets-first}}
|
||||
{{#data-main-menu-action}}{{>MainMenuAction}}{{/data-main-menu-action}}
|
||||
{{#array-portlets-rest}}{{>MainMenuGroup}}{{/array-portlets-rest}}
|
||||
{{^is-language-in-content}}
|
||||
{{#data-languages}}{{>MainMenuGroup}}{{/data-languages}}
|
||||
{{/is-language-in-content}}
|
||||
{{! T295555 Add language switch alert message. }}
|
||||
{{#data-vector-language-switch-alert}}{{>MainMenuAction}}{{/data-vector-language-switch-alert}}
|
||||
{{/is-page-tools-enabled}}
|
||||
|
||||
{{#is-page-tools-enabled}}
|
||||
{{#data-portlets-first}}{{>Menu}}{{/data-portlets-first}}
|
||||
{{#data-main-menu-action}}{{>MainMenuAction}}{{/data-main-menu-action}}
|
||||
{{#array-portlets-rest}}{{>Menu}}{{/array-portlets-rest}}
|
||||
|
@ -20,5 +8,4 @@
|
|||
{{/is-language-in-content}}
|
||||
{{! T295555 Add language switch alert message. }}
|
||||
{{#data-vector-language-switch-alert}}{{>MainMenuAction}}{{/data-vector-language-switch-alert}}
|
||||
{{/is-page-tools-enabled}}
|
||||
{{>PinnableElement/Close}}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{{!
|
||||
See @typedef MenuDefinition
|
||||
}}
|
||||
<div id="{{id}}" class="vector-main-menu-group vector-menu{{#class}} {{.}}{{/class}}" {{{html-tooltip}}} {{{html-user-language-attributes}}}>
|
||||
<div
|
||||
id="{{id}}-label"
|
||||
class="vector-menu-heading{{#heading-class}} {{.}}{{/heading-class}}"
|
||||
{{#aria-label}}aria-label="{{.}}"{{/aria-label}}
|
||||
>
|
||||
{{{html-vector-heading-icon}}}<span class="vector-menu-heading-label">{{label}}</span>
|
||||
</div>
|
||||
{{>MenuContents}}
|
||||
</div>
|
|
@ -11,17 +11,12 @@
|
|||
<div class="vector-main-menu-container {{^data-toc}}vector-sidebar-container-no-toc{{/data-toc}}">
|
||||
<div id="mw-navigation">
|
||||
<nav id="mw-panel" class="vector-main-menu-landmark" aria-label="{{msg-vector-site-nav-label}}" role="navigation">
|
||||
{{^is-page-tools-enabled}}
|
||||
{{#data-main-menu}}{{>MainMenu}}{{/data-main-menu}}
|
||||
{{/is-page-tools-enabled}}
|
||||
{{#is-page-tools-enabled}}
|
||||
{{#data-main-menu}}
|
||||
{{>PinnableContainer/Pinned/Open}}
|
||||
{{! Use `#vector-main-menu-pinned-container .vector-main-menu` to target styles at this element}}
|
||||
{{#is-pinned}}{{>MainMenu}}{{/is-pinned}}
|
||||
{{>PinnableContainer/Close}}
|
||||
{{/data-main-menu}}
|
||||
{{/is-page-tools-enabled}}
|
||||
{{#data-main-menu}}
|
||||
{{>PinnableContainer/Pinned/Open}}
|
||||
{{! Use `#vector-main-menu-pinned-container .vector-main-menu` to target styles at this element}}
|
||||
{{#is-pinned}}{{>MainMenu}}{{/is-pinned}}
|
||||
{{>PinnableContainer/Close}}
|
||||
{{/data-main-menu}}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
</nav>
|
||||
|
||||
<nav class="vector-page-tools-landmark" aria-label="{{msg-tooltip-p-cactions}}">
|
||||
{{#is-page-tools-enabled}}
|
||||
{{#data-page-tools-dropdown}}{{>Dropdown/Open}}{{/data-page-tools-dropdown}}
|
||||
{{#data-page-tools}}
|
||||
{{>PinnableContainer/Unpinned/Open}}
|
||||
|
@ -22,8 +21,6 @@
|
|||
{{>PinnableContainer/Close}}
|
||||
{{/data-page-tools}}
|
||||
{{#data-page-tools-dropdown}}{{>Dropdown/Close}}{{/data-page-tools-dropdown}}
|
||||
{{/is-page-tools-enabled}}
|
||||
{{^is-page-tools-enabled}}{{#data-actions}}{{>LegacyMoreMenu}}{{/data-actions}}{{/is-page-tools-enabled}}
|
||||
</nav>
|
||||
</div>
|
||||
{{/data-portlets}}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<div class="vector-sticky-header-context-bar-primary" aria-hidden="true" {{{html-user-language-attributes}}}>{{{html-title}}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vector-sticky-header-end{{^is-page-tools-enabled}} mw-ui-icon-flush-right{{/is-page-tools-enabled}}" aria-hidden="true">
|
||||
<div class="vector-sticky-header-end" aria-hidden="true">
|
||||
<div class="vector-sticky-header-icons">
|
||||
{{#data-icons}}
|
||||
{{>Button}}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<label
|
||||
id="mw-sidebar-button"
|
||||
class="mw-checkbox-hack-button mw-ui-icon mw-ui-button mw-ui-quiet mw-ui-icon-element mw-ui-icon-flush-right"
|
||||
for="mw-sidebar-checkbox"
|
||||
role="button"
|
||||
aria-controls="mw-panel"
|
||||
data-event-name="ui.sidebar"
|
||||
tabindex="0"
|
||||
title="{{msg-vector-main-menu-tooltip}}">
|
||||
<span>{{msg-vector-action-toggle-sidebar}}</span>
|
||||
</label>
|
|
@ -33,11 +33,6 @@
|
|||
<div class="mw-page-container">
|
||||
<a class="mw-jump-link" href="#bodyContent">{{msg-vector-jumptocontent}}</a>
|
||||
<div class="mw-page-container-inner">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="mw-sidebar-checkbox"
|
||||
class="mw-checkbox-hack-checkbox"
|
||||
{{#is-main-menu-visible}}checked{{/is-main-menu-visible}}>
|
||||
{{>Header}}
|
||||
{{>MainMenuPinned}}
|
||||
<div class="vector-sitenotice-container">
|
||||
|
@ -61,7 +56,7 @@
|
|||
<main id="content" class="mw-body" role="main">
|
||||
{{>PageTitlebar}}
|
||||
{{>PageToolbar}}
|
||||
{{#is-page-tools-enabled}}{{>ColumnEnd}}{{/is-page-tools-enabled}}
|
||||
{{>ColumnEnd}}
|
||||
<div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container>
|
||||
{{>BeforeContent}}
|
||||
{{! the #contentSub element is currently used by editors, do not hide or remove it
|
||||
|
@ -71,13 +66,10 @@
|
|||
{{{html-user-message}}}
|
||||
{{{html-body-content}}}
|
||||
{{{html-categories}}}
|
||||
{{#is-page-tools-enabled}}{{#is-language-in-content-bottom}}
|
||||
{{#is-language-in-content-bottom}}
|
||||
{{#data-lang-btn}}{{>LanguageDropdown}}{{/data-lang-btn}}
|
||||
{{/is-language-in-content-bottom}}{{/is-page-tools-enabled}}
|
||||
{{/is-language-in-content-bottom}}
|
||||
</div>
|
||||
{{^is-page-tools-enabled}}{{#is-language-in-content-bottom}}
|
||||
{{#data-lang-btn}}{{>LanguageDropdown}}{{/data-lang-btn}}
|
||||
{{/is-language-in-content-bottom}}{{/is-page-tools-enabled}}
|
||||
</main>
|
||||
{{{html-after-content}}}
|
||||
</div>
|
||||
|
|
|
@ -617,13 +617,6 @@
|
|||
"value": 28,
|
||||
"description": "@var The minimum number of headings required to collapse all headings in the sticky table of contents by default."
|
||||
},
|
||||
"VectorPageTools": {
|
||||
"value": {
|
||||
"logged_in": true,
|
||||
"logged_out": true
|
||||
},
|
||||
"description": "@var array Moves the tools links from the main menu into a new menu in the page toolbar"
|
||||
},
|
||||
"VectorZebraDesign": {
|
||||
"value": false,
|
||||
"description": "@var boolean Temporary feature flag that enables the zebra design for the Vector skin."
|
||||
|
|
|
@ -24,7 +24,7 @@ exports[`Sticky header renders 1`] = `
|
|||
<div class=\\"vector-sticky-header-context-bar-primary\\" aria-hidden=\\"true\\"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\\"vector-sticky-header-end mw-ui-icon-flush-right\\" aria-hidden=\\"true\\">
|
||||
<div class=\\"vector-sticky-header-end\\" aria-hidden=\\"true\\">
|
||||
<div class=\\"vector-sticky-header-icons\\">
|
||||
<a href=\\"#\\" id=\\"ca-talk-sticky-header\\" data-event-name=\\"talk-sticky-header\\" class=\\"mw-ui-button mw-ui-quiet mw-ui-icon mw-ui-icon-element mw-ui-icon-wikimedia-speechBubbles sticky-header-icon\\">
|
||||
<span></span>
|
||||
|
|
Loading…
Reference in a new issue