(bug 36788) Add classes to containing row on watchlist/history
authorBrad Jorsch <anomie.wikipedia@gmail.com>
Sat, 12 May 2012 03:33:04 +0000 (23:33 -0400)
committerBrad Jorsch <anomie.wikipedia@gmail.com>
Mon, 2 Jul 2012 03:28:21 +0000 (23:28 -0400)
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 <strong> tags to styling via CSS.

Change-Id: I90bc95db061274d4de782578a4e91f954481adfd

RELEASE-NOTES-1.20
includes/ChangesList.php
includes/actions/HistoryAction.php
resources/mediawiki.special/mediawiki.special.changeslist.css

index 021e4e8..3a373ff 100644 (file)
@@ -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 <strong></strong>
+  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 <span></span> tags with class "mw-title".
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
index e5be12d..da56050 100644 (file)
@@ -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 = '<span class="history-deleted">' . $articlelink . '</span>';
                }
-               # Bolden pages watched by this user
-               if( $watched ) {
-                       $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
-               }
+               # To allow for boldening pages watched by this user
+               $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
                # 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' );
 
index 50d210f..0c5560a 100644 (file)
@@ -635,6 +635,7 @@ class HistoryPager extends ReverseChronologicalPager {
 
                if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
                        $s2 .= ' <span class="updatedmarker">' .  $this->msg( 'updatedmarker' )->escaped() . '</span>';
+                       $classes[] = 'mw-history-line-updated';
                }
 
                $tools = array();
index cdc9704..8a5421e 100644 (file)
@@ -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;
+}