Annotate different parts of the contributions UI with classes
authorjdlrobson <jdlrobson@gmail.com>
Wed, 27 Mar 2019 18:31:39 +0000 (11:31 -0700)
committerjdlrobson <jdlrobson@gmail.com>
Thu, 28 Mar 2019 00:30:33 +0000 (17:30 -0700)
Distinguish the user tools (talk, block, block log etc)
from the pager navigation navigation bar so that skins can style
them.

Change-Id: I32950aa452347aabb8a37253bafc5f20d518c110

includes/specials/SpecialContributions.php
includes/specials/pagers/ContribsPager.php

index c0303b2..f60d5f0 100644 (file)
@@ -244,9 +244,9 @@ class SpecialContributions extends IncludableSpecialPage {
 
                                $output = $pager->getBody();
                                if ( !$this->including() ) {
-                                       $output = '<p>' . $pager->getNavigationBar() . '</p>' .
+                                       $output = $pager->getNavigationBar() .
                                                $output .
-                                               '<p>' . $pager->getNavigationBar() . '</p>';
+                                               $pager->getNavigationBar();
                                }
                                $out->addHTML( $output );
                        }
@@ -353,7 +353,9 @@ class SpecialContributions extends IncludableSpecialPage {
                        }
                }
 
-               return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );
+               return Html::rawElement( 'div', [ 'class' => 'mw-contributions-user-tools' ],
+                       $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() )
+               );
        }
 
        /**
index 382ba2f..626fc48 100644 (file)
@@ -154,6 +154,19 @@ class ContribsPager extends RangeChronologicalPager {
                return $query;
        }
 
+       /**
+        * Wrap the navigation bar in a p element with identifying class.
+        * In future we may want to change the `p` tag to a `div` and upstream
+        * this to the parent class.
+        *
+        * @return string HTML
+        */
+       function getNavigationBar() {
+               return Html::rawElement( 'p', [ 'class' => 'mw-pager-navigation-bar' ],
+                       parent::getNavigationBar()
+               );
+       }
+
        /**
         * This method basically executes the exact same code as the parent class, though with
         * a hook added, to allow extensions to add additional queries.