Apply the pseudo-css selector rules to diff and changelist pages
authorjdlrobson <jdlrobson@gmail.com>
Wed, 9 Jan 2019 00:30:18 +0000 (16:30 -0800)
committerjdlrobson <jdlrobson@gmail.com>
Thu, 21 Feb 2019 23:54:46 +0000 (15:54 -0800)
The styles that we are applying on changelist pages should also
apply on diff pages. This generalises the rules into a new
module.

To avoid problems with cached HTML mediawiki.special.changeslist
temporarily loads resources/src/mediawiki.interface.helpers.styles.
This will be removed after the change has been in production for a
week.

Bug: T212613
Change-Id: I6aad563e48f41c783df8b176a4f437e60a1255cc

includes/actions/HistoryAction.php
includes/changes/ChangesList.php
includes/changes/EnhancedChangesList.php
includes/diff/DifferenceEngine.php
includes/specialpage/ChangesListSpecialPage.php
includes/specials/SpecialContributions.php
resources/Resources.php
resources/src/mediawiki.diff.styles/header.less [deleted file]
resources/src/mediawiki.interface.helpers.styles.less [new file with mode: 0644]
resources/src/mediawiki.special.changeslist.less

index fdf4f85..39bc830 100644 (file)
@@ -133,6 +133,7 @@ class HistoryAction extends FormlessAction {
                $out->setFeedAppendQuery( 'action=history' );
                $out->addModules( 'mediawiki.action.history' );
                $out->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
                        'mediawiki.action.history.styles',
                        'mediawiki.special.changeslist',
                ] );
index b8ab971..bf275b3 100644 (file)
@@ -289,7 +289,10 @@ class ChangesList extends ContextSource {
                $this->rcCacheIndex = 0;
                $this->lastdate = '';
                $this->rclistOpen = false;
-               $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+               $this->getOutput()->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
+                       'mediawiki.special.changeslist'
+               ] );
 
                return '<div class="mw-changeslist">';
        }
index 51a26ba..3e98f65 100644 (file)
@@ -78,6 +78,7 @@ class EnhancedChangesList extends ChangesList {
                $this->rclistOpen = false;
                $this->getOutput()->addModuleStyles( [
                        'mediawiki.icon',
+                       'mediawiki.interface.helpers.styles',
                        'mediawiki.special.changeslist',
                        'mediawiki.special.changeslist.enhanced',
                ] );
index 87863a4..8e2b96d 100644 (file)
@@ -956,7 +956,10 @@ class DifferenceEngine extends ContextSource {
         */
        public function showDiffStyle() {
                if ( !$this->isSlotDiffRenderer ) {
-                       $this->getOutput()->addModuleStyles( 'mediawiki.diff.styles' );
+                       $this->getOutput()->addModuleStyles( [
+                               'mediawiki.interface.helpers.styles',
+                               'mediawiki.diff.styles'
+                       ] );
                        foreach ( $this->getSlotDiffRenderers() as $slotDiffRenderer ) {
                                $slotDiffRenderer->addModules( $this->getOutput() );
                        }
index dfdbc07..7cf36aa 100644 (file)
@@ -1691,6 +1691,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                $out = $this->getOutput();
                // Styles and behavior for the legend box (see makeLegend())
                $out->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
                        'mediawiki.special.changeslist.legend',
                        'mediawiki.special.changeslist',
                ] );
index 3a180db..8a48aa6 100644 (file)
@@ -42,6 +42,7 @@ class SpecialContributions extends IncludableSpecialPage {
                $out = $this->getOutput();
                // Modules required for viewing the list of contributions (also when included on other pages)
                $out->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
                        'mediawiki.special',
                        'mediawiki.special.changeslist',
                ] );
index 9293063..3ddc8aa 100644 (file)
@@ -914,9 +914,15 @@ return [
                ],
        ],
        'mediawiki.diff.styles' => [
+               // FIXME: Remove class and lessMessages
+               // when I6aad563e48f41c783df8b176a4f437e60a1255cc has
+               // been in production for 1 week.
                'class' => ResourceLoaderLessVarFileModule::class,
                'styles' => [
-                       'resources/src/mediawiki.diff.styles/header.less',
+                       // Remove resources/src/mediawiki.interface.helpers.styles.less
+                       // when I6aad563e48f41c783df8b176a4f437e60a1255cc has
+                       // been in production for 1 week.
+                       'resources/src/mediawiki.interface.helpers.styles.less',
                        'resources/src/mediawiki.diff.styles/diff.css',
                        'resources/src/mediawiki.diff.styles/print.css' => [
                                'media' => 'print'
@@ -925,6 +931,7 @@ return [
                'lessMessages' => [
                        'parentheses-start',
                        'parentheses-end',
+                       'pipe-separator'
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
@@ -2008,6 +2015,20 @@ return [
                        'oojs-ui.styles.icons-media',
                ],
        ],
+       'mediawiki.interface.helpers.styles' => [
+               'class' => ResourceLoaderLessVarFileModule::class,
+               'lessMessages' => [
+                       'parentheses-start',
+                       'parentheses-end',
+                       'pipe-separator'
+               ],
+               'styles' => [
+                       'resources/src/mediawiki.interface.helpers.styles.less',
+               ],
+               'targets' => [
+                       'desktop', 'mobile'
+               ],
+       ],
        'mediawiki.special' => [
                'styles' => [
                        'resources/src/mediawiki.special/special.less',
@@ -2123,13 +2144,21 @@ return [
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.special.changeslist' => [
+               // FIXME: Remove class and lessMessages
+               // when I6aad563e48f41c783df8b176a4f437e60a1255cc has
+               // been in production for 1 week.
                'class' => ResourceLoaderLessVarFileModule::class,
                'lessMessages' => [
                        'parentheses-start',
                        'parentheses-end',
                        'pipe-separator'
                ],
-               'styles' => 'resources/src/mediawiki.special.changeslist.less',
+               'styles' => [
+                       // FIXME: Remove this line when I6aad563e48f41c783df8b176a4f437e60a1255cc has
+                       // been in production for 1 week.
+                       'resources/src/mediawiki.interface.helpers.styles.less',
+                       'resources/src/mediawiki.special.changeslist.less',
+               ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.special.changeslist.enhanced' => [
diff --git a/resources/src/mediawiki.diff.styles/header.less b/resources/src/mediawiki.diff.styles/header.less
deleted file mode 100644 (file)
index d41ea08..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-.mw-tag-markers {
-       &:before {
-               content: '@{msg-parentheses-start}';
-       }
-
-       &:after {
-               content: '@{msg-parentheses-end}';
-       }
-}
diff --git a/resources/src/mediawiki.interface.helpers.styles.less b/resources/src/mediawiki.interface.helpers.styles.less
new file mode 100644 (file)
index 0000000..cfabab6
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * Helper classes used across special pages
+ */
+
+/* Content dividers */
+/* @todo FIXME: Hard coded ". .". Is there a message for this? Should there be? */
+.mw-changeslist-separator:empty:before {
+       content: '. .';
+}
+
+.comment--without-parentheses,
+.mw-changeslist-links,
+.mw-diff-bytes,
+/* Needed by pages calling ChangeTags::formatSummaryRow (T212613) */
+.mw-tag-markers,
+.mw-uctop {
+       &:before {
+               content: '@{msg-parentheses-start}';
+       }
+
+       &:after {
+               content: '@{msg-parentheses-end}';
+       }
+}
+
+.mw-changeslist-links {
+       display: inline-block;
+
+       > span:not( :first-child ):before {
+               content: '@{msg-pipe-separator}';
+       }
+}
index db33f4a..ce43855 100644 (file)
 .mw-rcfilters-ui-highlights {
        display: none;
 }
-
-/* Content dividers */
-/* @todo FIXME: Hard coded ". .". Is there a message for this? Should there be? */
-.mw-changeslist-separator:empty:before {
-       content: '. .';
-}
-
-.comment--without-parentheses,
-.mw-changeslist-links,
-.mw-diff-bytes,
-.mw-tag-markers,
-.mw-uctop {
-       &:before {
-               content: '@{msg-parentheses-start}';
-       }
-
-       &:after {
-               content: '@{msg-parentheses-end}';
-       }
-}
-
-.mw-changeslist-links {
-       display: inline-block;
-
-       > span:not( :first-child ):before {
-               content: '@{msg-pipe-separator}';
-       }
-}