mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-01 02:37:05 +00:00
9f2ca0d072
To complete the refactor, the Portal is also refactored as a Menu using the getMenu function. An old code path supporting portals outputted by hooks with strings is marked as deprecated to simplify this code in future. array-portals-first -> data-portals-first (the value is not an array) Changes: * $this->getLanguages and $this->getToolbox() always returns an array (see BaseTemplate) but we previously supported portals made using raw HTML. Let's move away from that behaviour and deprecate it. * Hooks are moved into buildSidebarProps and marked as deprecated where possible (SkinTemplateToolboxEnd). SidebarBeforeOutput can be used instead. Bug: T249372 Change-Id: I2549af3e24e5d51c09e9a88ca50a0d9b2e154c3f
67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
import sidebarTemplate from '!!raw-loader!../includes/templates/Sidebar.mustache';
|
|
import { vectorMenuTemplate } from './MenuDropdown.stories.data';
|
|
import { PORTALS } from './MenuPortal.stories.data';
|
|
|
|
const HTML_LOGO_ATTRIBUTES = `class="mw-wiki-logo" href="/wiki/Main_Page" title="Visit the main page"`;
|
|
const SIDEBAR_BEFORE_OUTPUT_HOOKINFO = `Beware: Portals can be added, removed or reordered using
|
|
SidebarBeforeOutput hook as in this example.`;
|
|
|
|
export { sidebarTemplate };
|
|
|
|
export const SIDEBAR_TEMPLATE_PARTIALS = {
|
|
Menu: vectorMenuTemplate
|
|
};
|
|
|
|
export const SIDEBAR_DATA = {
|
|
withNoPortals: {
|
|
'has-logo': true,
|
|
'array-portals-rest': [],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
},
|
|
withPortalsAndOptOut: {
|
|
'has-logo': false,
|
|
'data-portals-first': PORTALS.navigation,
|
|
'data-emphasized-sidebar-action': {
|
|
href: '#',
|
|
text: 'Switch to old look',
|
|
title: 'Change your settings to go back to the old look of the skin (legacy Vector)'
|
|
},
|
|
'array-portals-rest': [
|
|
PORTALS.toolbox,
|
|
PORTALS.otherProjects,
|
|
PORTALS.langlinks
|
|
],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
},
|
|
withPortals: {
|
|
'has-logo': true,
|
|
'data-portals-first': PORTALS.navigation,
|
|
'array-portals-rest': [
|
|
PORTALS.toolbox,
|
|
PORTALS.otherProjects,
|
|
PORTALS.langlinks
|
|
],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
},
|
|
withoutLogo: {
|
|
'has-logo': false,
|
|
'array-portals-first': PORTALS.navigation,
|
|
'array-portals-rest': [
|
|
PORTALS.toolbox,
|
|
PORTALS.otherProjects,
|
|
PORTALS.langlinks
|
|
]
|
|
},
|
|
thirdParty: {
|
|
'has-logo': true,
|
|
'array-portals-rest': [
|
|
PORTALS.toolbox,
|
|
PORTALS.navigation,
|
|
{
|
|
'html-portal-content': SIDEBAR_BEFORE_OUTPUT_HOOKINFO
|
|
}
|
|
],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
}
|
|
};
|