Mooeypoo has uploaded a new change for review.
https://gerrit.wikimedia.org/r/279071
Change subject: Clean up Special:Notifications output
......................................................................
Clean up Special:Notifications output
Bug: T129172
Change-Id: I65cb5f2a016fc2a3c33a0b1cd2f3f88ed963ab02
---
M Resources.php
M includes/special/SpecialNotifications.php
M modules/nojs/mw.echo.special.less
3 files changed, 32 insertions(+), 40 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/71/279071/1
diff --git a/Resources.php b/Resources.php
index 02cbdd1..41761b2 100644
--- a/Resources.php
+++ b/Resources.php
@@ -249,21 +249,6 @@
),
'targets' => array( 'desktop', 'mobile' ),
),
- 'ext.echo.special' => $echoResourceTemplate + array(
- 'scripts' => array(
- 'special/ext.echo.special.js',
- ),
- 'dependencies' => array(
- 'mediawiki.ui.button',
- 'mediawiki.api',
- 'ext.echo.ui.desktop',
- ),
- 'messages' => array(
- 'echo-load-more-error',
- 'echo-more-info',
- 'echo-feedback',
- ),
- ),
// HACK: OOUI has an icon pack for these, but it's unhelpfully large
and we don't
// want to load more as render-blocking CSS than we have to (T112401)
diff --git a/includes/special/SpecialNotifications.php
b/includes/special/SpecialNotifications.php
index 60296b9..0ab9e05 100644
--- a/includes/special/SpecialNotifications.php
+++ b/includes/special/SpecialNotifications.php
@@ -103,45 +103,48 @@
$notifArray[ $dateHeader ][ 'unread' ][] =
$row['id'];
}
- $notifArray[ $dateHeader ][ 'notices' ][] =
Html::rawElement(
- 'li',
- array(
- 'class' => $class,
+ $notifArray[ $dateHeader ][ 'notices' ][] = ( new
OOUI\Tag( 'li' ) )
+ ->addClasses( [ $class ] )
+ ->setAttributes( [
'data-notification-category' =>
$row['category'],
'data-notification-event' => $row['id'],
'data-notification-type' => $row['type']
- ),
- $row['*']
- );
+ ] )
+ ->appendContent( new OOUI\HtmlSnippet( $row[
'*' ] ) );
}
// Build the HTML
- $notices = '';
+ $notices = array();
foreach ( $notifArray as $section => $data ) {
- $sectionTitle = Html::element( 'span', array( 'class'
=> 'mw-echo-date-section-text' ), $section );
+ $sectionTitle = ( new OOUI\Tag( 'span' ) )
+ ->addClasses( [ 'mw-echo-date-section-text' ] )
+ ->appendContent( $section );
// Heading
- $notices .= Html::rawElement( 'li', array( 'class' =>
'mw-echo-date-section' ), $sectionTitle );
+ $notices[] = ( new OOUI\Tag( 'li' ) )
+ ->addClasses( [ 'mw-echo-date-section' ] )
+ ->appendContent( $sectionTitle );
// Notices
- $notices .= join( "\n", $data[ 'notices' ] );
+ $notices = array_merge( $notices, $data[ 'notices' ] );
}
- $html = Html::rawElement( 'ul', array( 'id' =>
'mw-echo-special-container' ), $notices );
+ $html = ( new OOUI\Tag( 'ul' ) )
+ ->setAttributes( [ 'id' => 'mw-echo-special-container'
] );
+ // 'appendContent' is variadic
+ call_user_func_array( [ $html, 'appendContent' ], $notices );
// Build the more link
if ( $nextContinue ) {
- $html .= Html::element(
- 'a',
- array(
- 'href' => SpecialPage::getTitleFor(
'Notifications' )->getLinkURL(
- array( 'continue' =>
$nextContinue )
- ),
- 'class' => 'mw-ui-button mw-ui-primary',
- 'id' => 'mw-echo-more'
- ),
- $this->msg( 'moredotdotdot' )->text()
- );
+ $moreButton = new OOUI\ButtonWidget( [
+ 'framed' => true,
+ 'href' => SpecialPage::getTitleFor(
'Notifications' )->getLinkURL(
+ array( 'continue' => $nextContinue ) ),
+ 'flags' => [ 'primary', 'constructive' ],
+ 'label' => $this->msg( 'moredotdotdot' )->text()
+ ] );
+ $moreButton->setAttributes( [ 'id' => 'mw-echo-more' ]
);
+ $html->appendContent( $moreButton );
}
$out->addHTML( $html );
diff --git a/modules/nojs/mw.echo.special.less
b/modules/nojs/mw.echo.special.less
index ed8b38c..9c4efc6 100644
--- a/modules/nojs/mw.echo.special.less
+++ b/modules/nojs/mw.echo.special.less
@@ -3,8 +3,12 @@
#mw-echo-more {
display: block;
text-align: center;
- font-size: 13px;
- max-width: 600px;
+ width: 100%;
+
+ .oo-ui-buttonElement-button {
+ width: 100%;
+ max-width: 570px;
+ }
}
/* Custom header styling for Vector and Monobook skins */
--
To view, visit https://gerrit.wikimedia.org/r/279071
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65cb5f2a016fc2a3c33a0b1cd2f3f88ed963ab02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits