feat: move some toolbox links into the drawer (#241)

* feat: Move some toolbox links into the drawer

* ci: lint code to MediaWiki standards

Check commit and GitHub actions for more details

Co-authored-by: github-actions <github-actions@users.noreply.github.com>
This commit is contained in:
H. C. Kruse 2021-01-27 22:53:01 +01:00 committed by GitHub
parent 1e95fbb35b
commit ea3c2daa4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,7 +334,6 @@ class SkinCitizen extends SkinMustache {
switch ( $name ) {
case 'SEARCH':
break;
case 'TOOLBOX':
break;
case 'LANGUAGES':
@ -371,10 +370,15 @@ class SkinCitizen extends SkinMustache {
}
$firstPortal = $props[0] ?? null;
if ( $firstPortal ) {
$firstPortal[ 'class' ] .= ' portal-first';
// Hide label for first portal
$firstPortal[ 'label-class' ] .= 'screen-reader-text';
if ( isset( $firstPortal['html-items'] ) ) {
$this->addToolboxLinksToDrawer( $firstPortal['html-items'] );
}
}
return [
@ -385,6 +389,44 @@ class SkinCitizen extends SkinMustache {
];
}
/**
* @inheritDoc
*
* Manually disable links to upload and speacial pages
* as they are moved from the toolbox to the drawer
*
* @return array
*/
protected function buildNavUrls() {
$urls = parent::buildNavUrls();
$urls['upload'] = false;
$urls['specialpages'] = false;
return $urls;
}
/**
* Add a link to special pages and the upload form to the first portal in the drawer
*
* @param string &$htmlItems
*
* @return void
*/
private function addToolboxLinksToDrawer( &$htmlItems ) {
// First add a link to special pages
$htmlItems .= $this->makeListItem( 'specialpages', [
'href' => self::makeSpecialUrl( 'specialpages' ),
'id' => 't-specialpages'
] );
// Then add a link to the upload form
$htmlItems .= $this->makeListItem( 'upload', [
'href' => self::makeSpecialUrl( 'upload' ),
'id' => 't-upload'
] );
}
/**
* Build Personal Tools menu
*