From c1bf80f8df72e333013f1645bf54c98da487b1d5 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 11 May 2012 23:33:04 -0400 Subject: [PATCH] (bug 36788) Add classes to containing row on watchlist/history Each line on the watchlist and on the history pages should have a specific class to indicate the "updated since my last visit" status, to allow for more comprehensive styling than is possible with individual elements embedded within the line. Also some cleanup: turn the $classes variable in the enhanced watchlist code path into an array, and change the bolding of titles in the watchlist from tags to styling via CSS. Change-Id: I90bc95db061274d4de782578a4e91f954481adfd --- RELEASE-NOTES-1.20 | 4 ++++ includes/ChangesList.php | 23 ++++++++++++------- includes/actions/HistoryAction.php | 1 + .../mediawiki.special.changeslist.css | 4 ++++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 021e4e8a7a..3a373ff968 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -78,6 +78,10 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. Will be null on previewing a page being created. * (bug 37627) UserNotLoggedIn() exception to show a generic error page whenever a user is not logged in. +* Watched status in changes lists are no longer indicated by + tags with class "mw-watched". Instead, each line now has a class + "mw-changeslist-line-watched" or "mw-changeslist-line-not-watched", and the + title itself is surrounded by tags with class "mw-title". === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/ChangesList.php b/includes/ChangesList.php index e5be12d8b6..da5605076e 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -192,6 +192,7 @@ class ChangesList extends ContextSource { $this->rcCacheIndex = 0; $this->lastdate = ''; $this->rclistOpen = false; + $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' ); return ''; } @@ -369,10 +370,8 @@ class ChangesList extends ContextSource { if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) { $articlelink = '' . $articlelink . ''; } - # Bolden pages watched by this user - if( $watched ) { - $articlelink = "{$articlelink}"; - } + # To allow for boldening pages watched by this user + $articlelink = "{$articlelink}"; # RTL/LTR marker $articlelink .= $this->getLanguage()->getDirMark(); @@ -588,6 +587,10 @@ class OldChangesList extends ChangesList { } } + // Indicate watched status on the line to allow for more + // comprehensive styling. + $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched'; + // Moved pages (very very old, not supported anymore) if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) { // Log entries @@ -837,14 +840,16 @@ class EnhancedChangesList extends ChangesList { wfProfileIn( __METHOD__ ); # Add the namespace and title of the block as part of the class + $classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' ); if ( $block[0]->mAttribs['rc_log_type'] ) { # Log entry - $classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' + $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] ); } else { - $classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' + $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] ); } + $classes[] = $block[0]->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched'; $r = Html::openElement( 'table', array( 'class' => $classes ) ) . Html::openElement( 'tr' ); @@ -1148,14 +1153,16 @@ class EnhancedChangesList extends ChangesList { $type = $rcObj->mAttribs['rc_type']; $logType = $rcObj->mAttribs['rc_log_type']; + $classes = array( 'mw-enhanced-rc' ); if( $logType ) { # Log entry - $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' + $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType . '-' . $rcObj->mAttribs['rc_title'] ); } else { - $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . + $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] ); } + $classes[] = $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched'; $r = Html::openElement( 'table', array( 'class' => $classes ) ) . Html::openElement( 'tr' ); diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 50d210f6e2..0c5560a808 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -635,6 +635,7 @@ class HistoryPager extends ReverseChronologicalPager { if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) { $s2 .= ' ' . $this->msg( 'updatedmarker' )->escaped() . ''; + $classes[] = 'mw-history-line-updated'; } $tools = array(); diff --git a/resources/mediawiki.special/mediawiki.special.changeslist.css b/resources/mediawiki.special/mediawiki.special.changeslist.css index cdc970426a..8a5421e86e 100644 --- a/resources/mediawiki.special/mediawiki.special.changeslist.css +++ b/resources/mediawiki.special/mediawiki.special.changeslist.css @@ -57,3 +57,7 @@ table.mw-enhanced-rc td.mw-enhanced-rc-nested { /* @embed */ background: url(images/arrow-expanded.png) no-repeat left center; } + +.mw-changeslist-line-watched .mw-title { + font-weight: bold; +} -- 2.20.1