Switch plain links to OOUI buttons in /history and diffs

Like we did for the button to create a new filter on
Special:AbuseFilter.

Bug: T132284
Change-Id: Ie4e43b74893b00b88dd5e7fd627a2572d3157acc
This commit is contained in:
Daimona Eaytoy 2018-04-24 11:35:07 +02:00
parent 913d37eba6
commit 26ef911517
2 changed files with 28 additions and 13 deletions

View file

@ -12,19 +12,29 @@ class AbuseFilterViewDiff extends AbuseFilterView {
public function show() {
$show = $this->loadData();
$out = $this->getOutput();
$out->enableOOUI();
$links = [];
if ( $this->mFilter ) {
$links['abusefilter-history-backedit'] = $this->getTitle( $this->mFilter );
$links['abusefilter-diff-backhistory'] = $this->getTitle( 'history/' . $this->mFilter );
$links['abusefilter-history-backedit'] =
$this->getTitle( $this->mFilter )->getFullURL();
$links['abusefilter-diff-backhistory'] =
$this->getTitle( 'history/' . $this->mFilter )->getFullURL();
}
foreach ( $links as $msg => $title ) {
$links[$msg] = $this->linkRenderer->makeLink( $title, $this->msg( $msg )->text() );
foreach ( $links as $msg => $href ) {
$links[$msg] =
new OOUI\ButtonWidget( [
'label' => $this->msg( $msg )->text(),
'href' => $href
] );
}
$backlinks = $this->getLanguage()->pipeList( $links );
$out->addHTML( Xml::tags( 'p', null, $backlinks ) );
$backlinks =
new OOUI\HorizontalLayout( [
'items' => $links
] );
$out->addHTML( $backlinks );
if ( $show ) {
$out->addHTML( $this->formatDiff() );

View file

@ -15,6 +15,7 @@ class AbuseFilterViewHistory extends AbuseFilterView {
*/
public function show() {
$out = $this->getOutput();
$out->enableOOUI();
$filter = $this->getRequest()->getText( 'filter' ) ?: $this->mFilter;
if ( $filter ) {
@ -34,18 +35,22 @@ class AbuseFilterViewHistory extends AbuseFilterView {
// Useful links
$links = [];
if ( $filter ) {
$links['abusefilter-history-backedit'] = $this->getTitle( $filter );
$links['abusefilter-history-backedit'] = $this->getTitle( $filter )->getFullURL();
}
foreach ( $links as $msg => $title ) {
$links[$msg] = $this->linkRenderer->makeLink(
$title,
new HtmlArmor( $this->msg( $msg )->parse() )
);
$links[$msg] =
new OOUI\ButtonWidget( [
'label' => $this->msg( $msg )->parse(),
'href' => $title
] );
}
$backlinks = $this->getLanguage()->pipeList( $links );
$out->addHTML( Xml::tags( 'p', null, $backlinks ) );
$backlinks =
new OOUI\HorizontalLayout( [
'items' => $links
] );
$out->addHTML( $backlinks );
// For user
$user = User::getCanonicalName( $this->getRequest()->getText( 'user' ), 'valid' );