mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-05 14:22:56 +00:00
698752e38a
Moving all the templateParser calls to one function so its easier to see how the template is composed. The diff of changes to the stories folder highlight the internal changes which are: * html-portals replaced with html-sidebar in main template * new Sidebar template added which outputs to html-sidebar * Mention of "MainMenu" replaced with better understood "Sidebar" This is precursory work to adopt templatePartials Change-Id: I6b2196e39087f818e774d04b2d1b9ab8cb8816a1
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
import mustache from 'mustache';
|
|
import sidebarTemplate from '!!raw-loader!../includes/templates/Sidebar.mustache';
|
|
import portalTemplate from '!!raw-loader!../includes/templates/Portal.mustache';
|
|
import { PORTALS } from './portal.stories.data';
|
|
import '../.storybook/common.less';
|
|
import '../resources/skins.vector.styles/navigation.less';
|
|
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 default {
|
|
title: 'Sidebar'
|
|
};
|
|
|
|
export const sidebarWithNoPortals = () => mustache.render( sidebarTemplate,
|
|
{
|
|
'array-portals': [],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
}
|
|
);
|
|
|
|
export const sidebarWithPortals = () => mustache.render( sidebarTemplate,
|
|
{
|
|
'array-portals': [
|
|
PORTALS.navigation,
|
|
PORTALS.toolbox,
|
|
PORTALS.otherProjects,
|
|
PORTALS.langlinks
|
|
],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
},
|
|
{
|
|
Portal: portalTemplate
|
|
}
|
|
);
|
|
|
|
export const sidebarThirdParty = () => mustache.render( sidebarTemplate,
|
|
{
|
|
'array-portals': [
|
|
PORTALS.toolbox,
|
|
PORTALS.navigation,
|
|
{
|
|
'html-portal-content': SIDEBAR_BEFORE_OUTPUT_HOOKINFO
|
|
}
|
|
],
|
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
|
},
|
|
{
|
|
Portal: portalTemplate
|
|
}
|
|
);
|