refactor(core): ♻️ use core sidebar data

This commit is contained in:
alistair3149 2022-10-04 22:20:29 -04:00
parent 9325a4e2be
commit a93f373269
No known key found for this signature in database
5 changed files with 10 additions and 12 deletions

View file

@ -80,10 +80,6 @@ final class Drawer extends Partial {
}
}
$sidebarData += [
'data-drawer-sitestats' => $this->getSiteStatsData()
];
return $sidebarData;
}
@ -128,7 +124,7 @@ final class Drawer extends Partial {
*
* @return array for use in Mustache template.
*/
private function getSiteStatsData(): array {
public function getSiteStatsData(): array {
$props = [];
if ( $this->getConfigValue( 'CitizenEnableDrawerSiteStats' ) ) {

View file

@ -95,11 +95,10 @@ class SkinCitizen extends SkinMustache {
'toc-enabled' => $out->isTOCEnabled(),
// Data objects
'data-header' => [
'data-drawer' => $drawer->decorateSidebarData( $parentData['data-portlets-sidebar'] ),
'data-personal-menu' => $header->buildPersonalMenu(),
'data-search-box' => $header->buildSearchProps(),
],
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
'data-sitestats' => $drawer->getSiteStatsData(),
// HTML strings
'html-title-heading--formatted' => $pageTitle->buildTitle( $parentData, $title ),
'html-citizen-jumptotop' => $this->msg( 'citizen-jumptotop' )->text() . ' [home]',
@ -109,6 +108,9 @@ class SkinCitizen extends SkinMustache {
// Needed to be parsed here as it should be wikitext
'msg-citizen-footer-desc' => $this->msg( "citizen-footer-desc" )->inContentLanguage()->parse(),
'msg-citizen-footer-tagline' => $this->msg( "citizen-footer-tagline" )->inContentLanguage()->parse(),
// Decorate data provided by core
'data-portlets-sidebar' => $drawer->decorateSidebarData( $parentData['data-portlets-sidebar'] ),
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
];
$data += $tools->getPageToolsData( $parentData );

View file

@ -15,14 +15,16 @@
<header class="citizen-drawer__header">
{{>Drawer__logo}}
<div class="citizen-drawer__siteinfo">
{{>Drawer__siteStats}}
{{#data-sitestats}}{{>Drawer__siteStats}}{{/data-sitestats}}
<div class="mw-logo-wordmark">{{msg-sitetitle}}</div>
</div>
</header>
{{#data-portlets-sidebar}}
<section class="citizen-drawer__menu">
{{#data-portlets-first}}{{>Menu}}{{/data-portlets-first}}
{{#array-portlets-rest}}{{>Menu}}{{/array-portlets-rest}}
</section>
{{/data-portlets-sidebar}}
</aside>
{{>Drawer__button}}
</div>

View file

@ -1,7 +1,5 @@
{{#data-drawer-sitestats}}
<div class="citizen-siteStats">
{{#array-drawer-sitestats-item}}
<div class="citizen-siteStats__item" id="citizen-siteStats__item--{{id}}" title="{{label}}">{{value}}</div>
{{/array-drawer-sitestats-item}}
</div>
{{/data-drawer-sitestats}}
</div>

View file

@ -4,7 +4,7 @@
}}
<header class="mw-header citizen-header">
{{#data-search-box}}{{>Search}}{{/data-search-box}}
{{#data-drawer}}{{>Drawer}}{{/data-drawer}}
{{>Drawer}}
<div class="citizen-header__inner">
<div class="citizen-header__start"></div>
<div class="citizen-header__end">