From: Matěj Suchánek Date: Tue, 9 Jul 2019 11:07:07 +0000 (+0200) Subject: Don't show tools on history view when no revisions can be shown X-Git-Tag: 1.34.0-rc.0~1062^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=18871dc06311362c4887883d9d59edd84239da59;p=lhc%2Fweb%2Fwiklou.git Don't show tools on history view when no revisions can be shown Change-Id: I31c1d22a444928bf73d7ae0c0904cd1fb93865f4 --- diff --git a/includes/actions/pagers/HistoryPager.php b/includes/actions/pagers/HistoryPager.php index c9c1b51a99..bc456feb55 100644 --- a/includes/actions/pagers/HistoryPager.php +++ b/includes/actions/pagers/HistoryPager.php @@ -185,34 +185,40 @@ class HistoryPager extends ReverseChronologicalPager { $s .= Html::hidden( 'type', 'revision' ) . "\n"; // Button container stored in $this->buttons for re-use in getEndBody() - $this->buttons = Html::openElement( 'div', [ 'class' => 'mw-history-compareselectedversions' ] ); - $className = 'historysubmit mw-history-compareselectedversions-button'; - $attrs = [ 'class' => $className ] - + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ); - $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(), - $attrs - ) . "\n"; - - $user = $this->getUser(); - $actionButtons = ''; - if ( $user->isAllowed( 'deleterevision' ) ) { - $actionButtons .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' ); - } - if ( $this->showTagEditUI ) { - $actionButtons .= $this->getRevisionButton( 'editchangetags', 'history-edit-tags' ); - } - if ( $actionButtons ) { - $this->buttons .= Xml::tags( 'div', [ 'class' => - 'mw-history-revisionactions' ], $actionButtons ); - } + $this->buttons = ''; + if ( $this->getNumRows() > 0 ) { + $this->buttons .= Html::openElement( + 'div', [ 'class' => 'mw-history-compareselectedversions' ] ); + $className = 'historysubmit mw-history-compareselectedversions-button'; + $attrs = [ 'class' => $className ] + + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ); + $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(), + $attrs + ) . "\n"; + + $user = $this->getUser(); + $actionButtons = ''; + if ( $user->isAllowed( 'deleterevision' ) ) { + $actionButtons .= $this->getRevisionButton( + 'revisiondelete', 'showhideselectedversions' ); + } + if ( $this->showTagEditUI ) { + $actionButtons .= $this->getRevisionButton( + 'editchangetags', 'history-edit-tags' ); + } + if ( $actionButtons ) { + $this->buttons .= Xml::tags( 'div', [ 'class' => + 'mw-history-revisionactions' ], $actionButtons ); + } - if ( $user->isAllowed( 'deleterevision' ) || $this->showTagEditUI ) { - $this->buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML(); - } + if ( $user->isAllowed( 'deleterevision' ) || $this->showTagEditUI ) { + $this->buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML(); + } - $this->buttons .= ''; + $this->buttons .= ''; - $s .= $this->buttons; + $s .= $this->buttons; + } $s .= '