Fix hiding of empty portlets on special pages

* Increased selector specificy so that .emptyPortlet works on portlets within
  #mw-page-header-links
* Moved the `ca-more` dropdown, only shown on mobile, into a new portlet so that
  `p-views` is really empty on Special pages, and has class .emptyPortlet
* Moved languages dropdown, also only shown on mobile, into the new portlet too.
  This way on special pages the two dropdowns are in a single <ul> list with two
  items, rather than two adjacent list each with one item. Also, grouping the
  mobile-only items together means the desktop CSS only has to hide the portlet,
  rather than the individual ietms.

Bug: T182533
Change-Id: I496af1805d200e1fd67b1232e1b3b029b08b82ca
isekai
evad37 7 years ago
parent 2e041b0509
commit b03a2a970f

@ -73,6 +73,11 @@ class TimelessTemplate extends BaseTemplate {
$this->pileOfTools['namespaces'], $this->pileOfTools['namespaces'],
'timeless-namespaces' 'timeless-namespaces'
) . ) .
$this->getPortlet(
'more',
$this->pileOfTools['more'],
'timeless-more'
) .
$this->getPortlet( $this->getPortlet(
'views', 'views',
$this->pileOfTools['page-primary'], $this->pileOfTools['page-primary'],
@ -583,6 +588,7 @@ class TimelessTemplate extends BaseTemplate {
'page-secondary' => [], 'page-secondary' => [],
'user' => [], 'user' => [],
'page-tertiary' => [], 'page-tertiary' => [],
'more' => [],
'general' => [] 'general' => []
]; ];
@ -617,7 +623,7 @@ class TimelessTemplate extends BaseTemplate {
'class' => 'dropdown-toggle' 'class' => 'dropdown-toggle'
]; ];
// Goes in the page-primary in mobile, doesn't appear otherwise // Only appears in mobile
if ( $this->data['language_urls'] !== false ) { if ( $this->data['language_urls'] !== false ) {
$pileOfTools['languages'] = [ $pileOfTools['languages'] = [
'text' => $this->getMsg( 'timeless-languages' )->escaped(), 'text' => $this->getMsg( 'timeless-languages' )->escaped(),
@ -661,11 +667,7 @@ class TimelessTemplate extends BaseTemplate {
foreach ( $pileOfTools as $navKey => $navBlock ) { foreach ( $pileOfTools as $navKey => $navBlock ) {
$currentSet = null; $currentSet = null;
if ( in_array( $navKey, [ if ( $navKey === 'contributions' ) {
'contributions',
'more',
'languages'
] ) ) {
$currentSet = 'page-primary'; $currentSet = 'page-primary';
} elseif ( in_array( $navKey, [ } elseif ( in_array( $navKey, [
'blockip', 'blockip',
@ -682,6 +684,11 @@ class TimelessTemplate extends BaseTemplate {
'permalink' 'permalink'
] ) ) { ] ) ) {
$currentSet = 'page-tertiary'; $currentSet = 'page-tertiary';
} elseif ( in_array( $navKey, [
'more',
'languages'
] ) ) {
$currentSet = 'more';
} else { } else {
$currentSet = 'general'; $currentSet = 'general';
} }

@ -228,7 +228,8 @@ div.suggestions {
margin-right: 1em; margin-right: 1em;
} }
} }
#p-views { #p-views,
#p-more {
float: right; float: right;
li { li {
@ -525,7 +526,8 @@ table.wikitable > * > tr > th {
} }
/* Portlets */ /* Portlets */
.emptyPortlet { .emptyPortlet,
#mw-page-header-links .emptyPortlet {
display: none; display: none;
} }
#p-lang.emptyPortlet { #p-lang.emptyPortlet {
@ -536,6 +538,7 @@ table.wikitable > * > tr > th {
#p-namespaces h3, #p-namespaces h3,
#p-views h3, #p-views h3,
#p-more h3,
#p-search h3 { #p-search h3 {
.hidden; .hidden;
} }

@ -105,8 +105,7 @@
} }
} }
#mw-page-header-links #ca-more, #mw-page-header-links #p-more,
#mw-page-header-links #ca-languages,
.sidebar-chunk h2 { .sidebar-chunk h2 {
display: none; display: none;
} }

Loading…
Cancel
Save