Merge "Switch plain links to OOUI buttons in /history and diffs"

This commit is contained in:
jenkins-bot 2018-04-26 13:45:08 +00:00 committed by Gerrit Code Review
commit fce4b4c305
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' );