Changes to portlets for greater compatibility with other skins

Rename `pagetools` to `views`, `pageactions` to `cactions`, and
`cactions` from last commit back to `pagemisc`.
Make empty portlets available on page but hidden (display:none)
 with css class emptyPortlet, which can be removed by scripts
that add links to portlets (mw.util.addPortletLink already does
this).

Bug: T181362
Change-Id: I56d5b9df529abbdfead26cc46b8fe28935b417c3
isekai
evad37 7 years ago
parent ca0e5e20f9
commit 212357d9b8

@ -74,7 +74,7 @@ class TimelessTemplate extends BaseTemplate {
'timeless-namespaces'
) .
$this->getPortlet(
'pagetools',
'views',
$this->pileOfTools['page-primary'],
'timeless-pagetools'
)
@ -176,12 +176,14 @@ class TimelessTemplate extends BaseTemplate {
if ( is_array( $content ) ) {
$contentText = Html::openElement( 'ul' );
foreach ( $content as $key => $item ) {
$contentText .= $this->makeListItem(
$key,
$item,
[ 'text-wrapper' => [ 'tag' => 'span' ] ]
);
if ( count( $content ) > 0 ) {
foreach ( $content as $key => $item ) {
$contentText .= $this->makeListItem(
$key,
$item,
[ 'text-wrapper' => [ 'tag' => 'span' ] ]
);
}
}
// Add in SkinTemplateToolboxEnd, if any
$contentText .= $hookContents;
@ -192,7 +194,7 @@ class TimelessTemplate extends BaseTemplate {
$html = Html::rawElement( 'div', [
'role' => 'navigation',
'class' => 'mw-portlet',
'class' => [ 'mw-portlet', 'emptyPortlet' => count( $content ) === 0 ],
'id' => Sanitizer::escapeId( 'p-' . $name ),
'title' => Linker::titleAttrib( 'p-' . $name ),
'aria-labelledby' => $labelId
@ -401,22 +403,18 @@ class TimelessTemplate extends BaseTemplate {
*/
protected function getPageToolSidebar() {
$pageTools = '';
if ( count( $this->pileOfTools['page-secondary'] ) > 0 ) {
$pageTools .= $this->getPortlet(
'pageactions',
$this->pileOfTools['page-secondary'],
'timeless-pageactions'
);
}
if ( count( $this->pileOfTools['user'] ) > 0 ) {
$pageTools .= $this->getPortlet(
'userpagetools',
$this->pileOfTools['user'],
'timeless-userpagetools'
);
}
$pageTools .= $this->getPortlet(
'cactions',
$this->pileOfTools['page-secondary'],
'timeless-pageactions'
);
$pageTools .= $this->getPortlet(
'userpagetools',
$this->pileOfTools['user'],
'timeless-userpagetools'
);
$pageTools .= $this->getPortlet(
'pagemisc',
$this->pileOfTools['page-tertiary'],
'timeless-pagemisc'
);

@ -228,7 +228,7 @@ div.suggestions {
margin-right: 1em;
}
}
#p-pagetools {
#p-views {
float: right;
li {
@ -522,10 +522,15 @@ table.wikitable > * > tr > th {
margin-right: @column-right-size + 1em;
}
/* Portlets */
.emptyPortlet {
display: none;
}
/* Hidden stuff */
#p-namespaces h3,
#p-pagetools h3,
#p-views h3,
#p-search h3 {
.hidden;
}

Loading…
Cancel
Save