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

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

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

Loading…
Cancel
Save