Separate opt out data from sidebar

In preparation for using the data provided by SkinMustache class
we need to separate the opt out data from the rest of the sidebar.
The opt out data is specific to Vector.

Change-Id: I4461da92c1787d272bbf99e6644bdb9e6c388a68
This commit is contained in:
jdlrobson 2020-10-08 14:51:27 -07:00 committed by VolkerE
parent 924c751421
commit 227534102a
3 changed files with 13 additions and 19 deletions

View file

@ -139,7 +139,7 @@ class SkinVector extends SkinMustache {
if ( $skin->getUser()->isLoggedIn() ) {
// Note: This data is also passed to legacy template where it is unused.
$commonSkinData['data-sidebar']['data-emphasized-sidebar-action'] = [
$commonSkinData['data-emphasized-sidebar-action'] = [
'href' => SpecialPage::getTitleFor(
'Preferences',
false,

View file

@ -15,25 +15,19 @@ export const SIDEBAR_TEMPLATE_PARTIALS = {
Menu: vectorMenuTemplate
};
export const OPT_OUT_DATA = {
'data-emphasized-sidebar-action': {
href: '#',
'msg-vector-opt-out': 'Switch to old look',
'msg-vector-opt-out-tooltip': 'Change your settings to go back to the old look of the skin (legacy Vector)'
}
};
export const SIDEBAR_DATA = {
withNoPortals: {
'array-portals-rest': [],
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
},
withPortalsAndOptOut: {
'data-portals-first': PORTALS.navigation,
'data-emphasized-sidebar-action': {
href: '#',
'msg-vector-opt-out': 'Switch to old look',
'msg-vector-opt-out-tooltip': 'Change your settings to go back to the old look of the skin (legacy Vector)'
},
'array-portals-rest': [
PORTALS.toolbox,
PORTALS.otherProjects
],
'data-portals-languages': PORTALS.langlinks,
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
},
withPortals: {
'data-portals-first': PORTALS.navigation,
'array-portals-rest': [

View file

@ -11,23 +11,23 @@ import { PERSONAL_MENU_TEMPLATE_DATA, menuTemplate } from './Menu.stories.data';
import { pageActionsData, namespaceTabsData } from './MenuTabs.stories.data';
import { vectorMenuTemplate, moreData, variantsData } from './MenuDropdown.stories.data';
import { searchBoxData, searchBoxTemplate } from './SearchBox.stories.data';
import { SIDEBAR_DATA, SIDEBAR_TEMPLATE_PARTIALS,
import { SIDEBAR_DATA, SIDEBAR_TEMPLATE_PARTIALS, OPT_OUT_DATA,
sidebarLegacyTemplate, sidebarTemplate } from './Sidebar.stories.data';
import { FOOTER_TEMPLATE_DATA, FOOTER_TEMPLATE_PARTIALS,
footerTemplate } from './Footer.stories.data';
import { logoTemplate } from './Logo.stories.data';
export const NAVIGATION_TEMPLATE_DATA = {
loggedInWithVariantsAndOptOut: {
loggedInWithVariantsAndOptOut: Object.assign( {}, {
'data-personal-menu': PERSONAL_MENU_TEMPLATE_DATA.loggedInWithEcho,
'data-namespace-tabs': namespaceTabsData,
'data-page-actions': pageActionsData,
'data-variants': variantsData,
'data-search-box': searchBoxData,
'data-sidebar': SIDEBAR_DATA.withPortalsAndOptOut,
'data-sidebar': SIDEBAR_DATA.withPortals,
'msg-navigation-heading': 'Navigation menu',
'html-logo-attributes': `class="mw-wiki-logo" href="/wiki/Main_Page" title="Visit the main page"`
},
}, OPT_OUT_DATA ),
loggedOutWithVariants: {
'data-personal-menu': PERSONAL_MENU_TEMPLATE_DATA.loggedOut,
'data-namespace-tabs': namespaceTabsData,