Add CSS classes for diff/hist links at Enhanced RC
authorEddie Greiner-Petter <git@eddie-sh.de>
Tue, 21 Feb 2017 02:25:39 +0000 (03:25 +0100)
committerEddieGP <wikimedia.org@eddie-sh.de>
Thu, 2 Mar 2017 17:41:31 +0000 (17:41 +0000)
CSS classes mw-changeslist-diff and mw-changeslist-history should be
added to diff and history links in recent changes. There is already a
patch for the old recent changes page, this one adds the same classes
onto the enhanced recent changes page (class EnhancedChangesList). As
enhanced RC has a lot more links, this patch introduces two new css
classes for some links, one named  #mw-changeslist-diff-cur which is for
the diff that links to a current version within nested changes and the
other named #mw-changeslist-groupdiff which is for the 'summary diff'
that appears for a group of nested changes.
Follow-up: I2d5ef8c180ae4ff6e7f5d0ab443dc7084f8c4c77

Bug: T157178
Change-Id: Ib51639a92b5925f2bad0aebd4f7068b178f65017

includes/changes/EnhancedChangesList.php
includes/changes/RCCacheEntryFactory.php

index d02eec8..3aad60e 100644 (file)
@@ -531,7 +531,7 @@ class EnhancedChangesList extends ChangesList {
                                $links['total-changes'] = $this->linkRenderer->makeKnownLink(
                                        $block0->getTitle(),
                                        new HtmlArmor( $nchanges[$n] ),
-                                       [],
+                                       [ 'class' => 'mw-changeslist-groupdiff' ],
                                        $queryParams + [
                                                'diff' => $currentRevision,
                                                'oldid' => $last->mAttribs['rc_last_oldid'],
@@ -541,7 +541,7 @@ class EnhancedChangesList extends ChangesList {
                                        $links['total-changes-since-last'] = $this->linkRenderer->makeKnownLink(
                                                        $block0->getTitle(),
                                                        new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
-                                                       [],
+                                                       [ 'class' => 'mw-changeslist-groupdiff' ],
                                                        $queryParams + [
                                                                'diff' => $currentRevision,
                                                                'oldid' => $unvisitedOldid,
@@ -563,7 +563,7 @@ class EnhancedChangesList extends ChangesList {
                        $links['history'] = $this->linkRenderer->makeKnownLink(
                                        $block0->getTitle(),
                                        new HtmlArmor( $this->message['enhancedrc-history'] ),
-                                       [],
+                                       [ 'class' => 'mw-changeslist-history' ],
                                        $params
                                );
                }
@@ -718,7 +718,7 @@ class EnhancedChangesList extends ChangesList {
                                        . $this->linkRenderer->makeKnownLink(
                                                $pageTitle,
                                                new HtmlArmor( $this->message['hist'] ),
-                                               [],
+                                               [ 'class' => 'mw-changeslist-history' ],
                                                $query
                                        ) )->escaped();
                return $retVal;
index 2c5c8b1..8ce21f5 100644 (file)
@@ -186,7 +186,7 @@ class RCCacheEntryFactory {
                        $curLink = $curMessage;
                } else {
                        $curUrl = htmlspecialchars( $cacheEntry->getTitle()->getLinkURL( $queryParams ) );
-                       $curLink = "<a href=\"$curUrl\">$curMessage</a>";
+                       $curLink = "<a class=\"mw-changeslist-diff-cur\" href=\"$curUrl\">$curMessage</a>";
                }
 
                return $curLink;
@@ -229,16 +229,18 @@ class RCCacheEntryFactory {
                                return $diffMessage;
                        }
                        $diffUrl = htmlspecialchars( $pageTitle->getLinkURL( $queryParams ) );
-                       $diffLink = "<a href=\"$diffUrl\">$diffMessage</a>";
+                       $diffLink = "<a class=\"mw-changeslist-diff\" href=\"$diffUrl\">$diffMessage</a>";
                } else {
                        $diffUrl = htmlspecialchars( $cacheEntry->getTitle()->getLinkURL( $queryParams ) );
-                       $diffLink = "<a href=\"$diffUrl\">$diffMessage</a>";
+                       $diffLink = "<a class=\"mw-changeslist-diff\" href=\"$diffUrl\">$diffMessage</a>";
                }
 
                return $diffLink;
        }
 
        /**
+        * Builds the link to the previous version
+        *
         * @param RecentChange $cacheEntry
         * @param bool $showDiffLinks
         *
@@ -257,7 +259,7 @@ class RCCacheEntryFactory {
                        $lastLink = $this->linkRenderer->makeKnownLink(
                                $cacheEntry->getTitle(),
                                new HtmlArmor( $lastMessage ),
-                               [],
+                               [ 'class' => 'mw-changeslist-diff' ],
                                $this->buildDiffQueryParams( $cacheEntry )
                        );
                }