Merge pull request #242 from StarCitizenTools/dev

feat: move some toolbox links into the drawer (#241)
This commit is contained in:
alistair3149 2021-01-27 16:53:42 -05:00 committed by GitHub
commit db5ded1059
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 ) { switch ( $name ) {
case 'SEARCH': case 'SEARCH':
break;
case 'TOOLBOX': case 'TOOLBOX':
break; break;
case 'LANGUAGES': case 'LANGUAGES':
@ -371,10 +370,15 @@ class SkinCitizen extends SkinMustache {
} }
$firstPortal = $props[0] ?? null; $firstPortal = $props[0] ?? null;
if ( $firstPortal ) { if ( $firstPortal ) {
$firstPortal[ 'class' ] .= ' portal-first'; $firstPortal[ 'class' ] .= ' portal-first';
// Hide label for first portal // Hide label for first portal
$firstPortal[ 'label-class' ] .= 'screen-reader-text'; $firstPortal[ 'label-class' ] .= 'screen-reader-text';
if ( isset( $firstPortal['html-items'] ) ) {
$this->addToolboxLinksToDrawer( $firstPortal['html-items'] );
}
} }
return [ 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 * Build Personal Tools menu
* *