Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/111146

Change subject: Hygiene: Cleanup naming convention for special page RL modules
......................................................................

Hygiene: Cleanup naming convention for special page RL modules

Change-Id: Ibe727f345ba7ce63d1157f3a169f5267ea5b6481
---
M includes/MobileFrontend.hooks.php
M includes/Resources.php
M includes/specials/MobileSpecialPage.php
M includes/specials/MobileSpecialPageFeed.php
M includes/specials/SpecialMobileDiff.php
M includes/specials/SpecialMobileNotifications.php
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/SpecialNearby.php
R less/specials/pagefeed.less
9 files changed, 175 insertions(+), 164 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/46/111146/1

diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b6250a9..2903a97 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -402,14 +402,14 @@
                // Ensure desktop version of Special:Preferences page gets 
mobile targeted modules
                // FIXME: Upstream to core (?)
                if ( $name === 'Preferences' && $skin === 'minerva' ) {
-                       $out->addModules( 'minerva.special.preferences' );
+                       $out->addModules( 
'skins.minerva.special.preferences.scripts' );
                }
 
                if ( $isMobileView ) {
                        if ( $name === 'Search' ) {
-                               $out->addModuleStyles( 'mobile.search.styles' );
+                               $out->addModuleStyles( 
'skins.minerva.special.search.styles' );
                        } else if ( $name === 'Userlogin' ) {
-                               $out->addModuleStyles( 
'mobile.userlogin.styles' );
+                               $out->addModuleStyles( 
'skins.minerva.special.userlogin.styles' );
                                // make sure we're on https if we're supposed 
to be and currently aren't.
                                // most of this is lifted from https redirect 
code in SpecialUserlogin::execute()
                                // also, checking for 'https' in $wgServer is a 
little funky, but this is what
diff --git a/includes/Resources.php b/includes/Resources.php
index cffe597..3118ac1 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -860,111 +860,6 @@
                ),
        ),
 
-       'mobile.site' => array(
-               'dependencies' => array( 'mobile.startup' ),
-               'class' => 'MobileSiteModule',
-       ),
-
-       // Resources to be loaded on desktop version of site
-       'mobile.desktop' => array(
-               'scripts' => array( 
'javascripts/desktop/unset_stopmobileredirect.js' ),
-               'dependencies' => array( 'jquery.cookie' ),
-               'localBasePath' => $localBasePath,
-               'remoteExtPath' => $remoteExtPath,
-               'targets' => 'desktop',
-       ),
-
-       /**
-               * Special page modules
-               * FIXME: Remove the need for these by making more reusable CSS
-               * FIXME: Rename these modules in the interim to clarify that 
they are modules for use on special pages
-               *
-               * Note: Use correct names to ensure modules load on pages
-               * Name must be the name of the special page lowercased prefixed 
by 'mobile.'
-               * suffixed by '.styles' or '.scripts'
-               */
-       // Special:UserProfile
-       'mobile.special.styles' => $wgMFMobileSpecialPageResourceBoilerplate + 
array(
-               'styles' => array(
-                       'less/specials/common.less',
-               ),
-       ),
-
-       'minerva.special.preferences' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-               'scripts' => array(
-                       'javascripts/specials/preferences.js',
-               ),
-       ),
-
-       'mobile.mobilemenu.styles' => 
$wgMFMobileSpecialPageResourceStyleBoilerplate + array(
-               'styles' => array(
-                       'less/specials/mobilemenu.less',
-               ),
-       ),
-       'mobile.mobileoptions.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-               'styles' => array(
-                       'less/specials/mobileoptions.less',
-               ),
-       ),
-       'mobile.mobileoptions.scripts' => $wgMFMobileResourceBoilerplate + 
array(
-               'position' => 'top',
-               'dependencies' => array(
-                       'mobile.startup',
-                       'mobile.templates',
-               ),
-               'scripts' => array(
-                       'javascripts/specials/mobileoptions.js',
-               ),
-               'templates' => array(
-                       'specials/mobileoptions/checkbox',
-               ),
-               'messages' => array(
-                       'mobile-frontend-off',
-                       'mobile-frontend-on',
-                       'mobile-frontend-expand-sections-description',
-                       'mobile-frontend-expand-sections-status',
-               ),
-       ),
-       'mobile.mobileeditor.scripts' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-                       'scripts' => array(
-                                       
'javascripts/specials/redirectmobileeditor.js',
-                       ),
-       ),
-
-       'mobile.nearby.styles' => $wgMFMobileResourceBoilerplate + array(
-               'styles' => array(
-                       'less/specials/nearby.less',
-               ),
-               'skinStyles' => array(
-                       'vector' => 'less/desktop/special/nearby.less',
-               ),
-       ),
-
-       // FIXME: Merge with mobile.nearby when geonotahack moves to  stable
-       'mobile.nearby.beta' => $wgMFMobileResourceBoilerplate + array(
-               'messages' => array(
-                       // NearbyOverlay.js
-                       'mobile-frontend-nearby-to-page',
-                       'mobile-frontend-nearby-title',
-
-                       // PagePreviewOverlay
-                       'mobile-frontend-nearby-directions',
-                       'mobile-frontend-nearby-link',
-               ),
-               'templates' => array(
-                       'overlays/nearby',
-               ),
-               'dependencies' => array(
-                       'mobile.stable.common',
-                       'mobile.nearby',
-                       'mobile.beta.common',
-               ),
-               'scripts' => array(
-                       'javascripts/modules/nearby/PagePreviewOverlay.js',
-                       'javascripts/modules/nearby/NearbyOverlay.js',
-               )
-       ),
-
        'mobile.nearby' => $wgMFMobileResourceBoilerplate + array(
                'templates' => array(
                        'articleList',
@@ -972,7 +867,8 @@
                ),
                'dependencies' => array(
                        'mobile.stable.common',
-                       'mobile.nearby.styles',
+                       // FIXME: Kill this dependency!
+                       'mediawiki.special.nearby.styles',
                        'jquery.json',
                        'mediawiki.language',
                        'mobile.templates',
@@ -998,36 +894,6 @@
                'scripts' => array(
                        'javascripts/modules/nearby/NearbyApi.js',
                        'javascripts/modules/nearby/Nearby.js',
-               ),
-       ),
-
-       'mobile.nearby.scripts' => $wgMFMobileResourceBoilerplate + array(
-               'dependencies' => array(
-                       'mobile.nearby',
-               ),
-               'messages' => array(
-                       // specials/nearby.js
-                       'mobile-frontend-nearby-refresh',
-               ),
-               'scripts' => array(
-                       'javascripts/specials/nearby.js',
-               ),
-               // stop flash of unstyled content when loading from cache
-               'position' => 'top',
-       ),
-       'mobile.notifications.special.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-               'styles' => array(
-                       'less/specials/notifications.less',
-               ),
-               'position' => 'top',
-       ),
-       'mobile.notifications.special.scripts' => 
$wgMFMobileSpecialPageResourceScriptBoilerplate + array(
-               'scripts' => array(
-                       'javascripts/specials/notifications.js',
-               ),
-               'messages' => array(
-                       // defined in Echo
-                       'echo-load-more-error',
                ),
        ),
 
@@ -1062,37 +928,145 @@
                ),
        ),
 
-       'mobile.search.styles' => $wgMFMobileSpecialPageResourceBoilerplate + 
array(
+       'mobile.site' => array(
+               'dependencies' => array( 'mobile.startup' ),
+               'class' => 'MobileSiteModule',
+       ),
+
+       // Resources to be loaded on desktop version of site
+       'mobile.desktop' => array(
+               'scripts' => array( 
'javascripts/desktop/unset_stopmobileredirect.js' ),
+               'dependencies' => array( 'jquery.cookie' ),
+               'localBasePath' => $localBasePath,
+               'remoteExtPath' => $remoteExtPath,
+               'targets' => 'desktop',
+       ),
+
+       /**
+               * Special page modules
+               * FIXME: Remove the need for these by making more reusable CSS
+               * FIXME: Rename these modules in the interim to clarify that 
they are modules for use on special pages
+               *
+               * Note: Use correct names to ensure modules load on pages
+               * Name must be the name of the special page lowercased prefixed 
by 'mobile.'
+               * suffixed by '.styles' or '.scripts'
+               */
+       // Special:UserProfile
+       'mobile.special.styles' => $wgMFMobileSpecialPageResourceBoilerplate + 
array(
                'styles' => array(
-                       'less/specials/search.less',
+                       'less/specials/common.less',
                ),
        ),
-       'mobile.watchlist.scripts' => $wgMFMobileSpecialPageResourceBoilerplate 
+ array(
+
+       // Special pages introduced by MobileFrontend
+       'mediawiki.special.mobilemenu.styles' => 
$wgMFMobileSpecialPageResourceStyleBoilerplate + array(
+               'styles' => array(
+                       'less/specials/mobilemenu.less',
+               ),
+       ),
+       'mediawiki.special.mobileoptions.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'styles' => array(
+                       'less/specials/mobileoptions.less',
+               ),
+       ),
+       'mediawiki.special.mobileoptions.scripts' => 
$wgMFMobileResourceBoilerplate + array(
+               'position' => 'top',
                'dependencies' => array(
-                       'mobile.loggingSchemas',
-                       'mobile.stable',
+                       'mobile.startup',
+                       'mobile.templates',
                ),
                'scripts' => array(
-                       'javascripts/specials/watchlist.js',
+                       'javascripts/specials/mobileoptions.js',
+               ),
+               'templates' => array(
+                       'specials/mobileoptions/checkbox',
+               ),
+               'messages' => array(
+                       'mobile-frontend-off',
+                       'mobile-frontend-on',
+                       'mobile-frontend-expand-sections-description',
+                       'mobile-frontend-expand-sections-status',
                ),
        ),
-       'mobile.watchlist.styles' => $wgMFMobileSpecialPageResourceBoilerplate 
+ array(
+       'mediawiki.special.mobileeditor.scripts' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+                       'scripts' => array(
+                                       
'javascripts/specials/redirectmobileeditor.js',
+                       ),
+       ),
+
+       'mediawiki.special.nearby.styles' => $wgMFMobileResourceBoilerplate + 
array(
                'styles' => array(
-                       'less/specials/watchlist.less',
+                       'less/specials/nearby.less',
+               ),
+               'skinStyles' => array(
+                       'vector' => 'less/desktop/special/nearby.less',
                ),
        ),
-       'mobile.userlogin.styles' => $wgMFMobileSpecialPageResourceBoilerplate 
+ array(
+
+       // FIXME: Merge with mobile.nearby when geonotahack moves to  stable
+       'mediawiki.special.nearby.beta' => $wgMFMobileResourceBoilerplate + 
array(
+               'messages' => array(
+                       // NearbyOverlay.js
+                       'mobile-frontend-nearby-to-page',
+                       'mobile-frontend-nearby-title',
+
+                       // PagePreviewOverlay
+                       'mobile-frontend-nearby-directions',
+                       'mobile-frontend-nearby-link',
+               ),
+               'templates' => array(
+                       'overlays/nearby',
+               ),
+               'dependencies' => array(
+                       'mobile.stable.common',
+                       'mobile.nearby',
+                       'mobile.beta.common',
+               ),
+               'scripts' => array(
+                       'javascripts/modules/nearby/PagePreviewOverlay.js',
+                       'javascripts/modules/nearby/NearbyOverlay.js',
+               )
+       ),
+
+       'mediawiki.special.nearby.scripts' => $wgMFMobileResourceBoilerplate + 
array(
+               'dependencies' => array(
+                       'mobile.nearby',
+               ),
+               'messages' => array(
+                       // specials/nearby.js
+                       'mobile-frontend-nearby-refresh',
+               ),
+               'scripts' => array(
+                       'javascripts/specials/nearby.js',
+               ),
+               // stop flash of unstyled content when loading from cache
+               'position' => 'top',
+       ),
+
+       'mediawiki.special.notifications.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
                'styles' => array(
-                       'less/specials/userlogin.less',
+                       'less/specials/notifications.less',
+               ),
+               'position' => 'top',
+       ),
+
+       'mediawiki.special.notifications.scripts' => 
$wgMFMobileSpecialPageResourceScriptBoilerplate + array(
+               'scripts' => array(
+                       'javascripts/specials/notifications.js',
+               ),
+               'messages' => array(
+                       // defined in Echo
+                       'echo-load-more-error',
                ),
        ),
-       // Special:UserProfile
-       'mobile.userprofile.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+
+       'mediawiki.special.userprofile.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
                'styles' => array(
                        'less/specials/userprofile.less',
                ),
        ),
-       'mobile.uploads.scripts' => $wgMFMobileResourceBoilerplate + array(
+
+       'mediawiki.special.uploads.scripts' => $wgMFMobileResourceBoilerplate + 
array(
                'dependencies' => array(
                        'mobile.stable.styles',
                        'mobile.stable.common',
@@ -1115,22 +1089,29 @@
                ),
                'position' => 'top',
        ),
-       'mobile.uploads.styles' => $wgMFMobileSpecialPageResourceBoilerplate + 
array(
+
+       'mediawiki.special.uploads.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
                'styles' => array(
                        'less/specials/uploads.less',
                        'less/modules/uploads/PhotoUploaderButton.less',
                ),
        ),
-       'mobile.mobilediff.styles' => $wgMFMobileSpecialPageResourceBoilerplate 
+ array(
+
+       'mediawiki.special.pagefeed.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
                'styles' => array(
-                       'less/specials/watchlist.less',
+                       'less/specials/pagefeed.less',
+               ),
+       ),
+
+       'mediawiki.special.mobilediff.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'styles' => array(
                        'less/specials/mobilediff.less',
                ),
        ),
 
        // Note that this module is declared as a dependency in the Thanks 
extension (for the
        // mobile diff thanks button code). Keep the module name there in sync 
with this one.
-       'mobile.mobilediff.scripts' => $wgMFMobileResourceBoilerplate + array(
+       'mediawiki.special.mobilediff.scripts' => 
$wgMFMobileResourceBoilerplate + array(
                'dependencies' => array(
                        'mobile.loggingSchemas',
                        'mobile.stable.common',
@@ -1139,6 +1120,35 @@
                        'javascripts/specials/mobilediff.js',
                ),
        ),
+
+       // Skin Minerva specific special page styles
+       'skins.minerva.special.preferences.scripts' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'scripts' => array(
+                       'javascripts/specials/preferences.js',
+               ),
+       ),
+
+       'skins.minerva.special.search.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'styles' => array(
+                       'less/specials/search.less',
+               ),
+       ),
+
+       'skins.minerva.special.watchlist.scripts' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'dependencies' => array(
+                       'mobile.loggingSchemas',
+                       'mobile.stable',
+               ),
+               'scripts' => array(
+                       'javascripts/specials/watchlist.js',
+               ),
+       ),
+
+       'skins.minerva.special.userlogin.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
+               'styles' => array(
+                       'less/specials/userlogin.less',
+               ),
+       ),
 ) );
 
 unset( $localBasePath );
diff --git a/includes/specials/MobileSpecialPage.php 
b/includes/specials/MobileSpecialPage.php
index 268dcb8..a306080 100644
--- a/includes/specials/MobileSpecialPage.php
+++ b/includes/specials/MobileSpecialPage.php
@@ -60,8 +60,8 @@
                list( $name, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
                $id = strtolower( $name );
                // FIXME: These names should be more specific
-               $specialStyleModuleName = 'mobile.' . $id . '.styles';
-               $specialScriptModuleName = 'mobile.' . $id . '.scripts';
+               $specialStyleModuleName = 'mediawiki.special.' . $id . 
'.styles';
+               $specialScriptModuleName = 'mediawiki.special.' . $id . 
'.scripts';
 
                if ( $rl->getModule( $specialStyleModuleName ) ) {
                        $out->addModuleStyles( $specialStyleModuleName );
diff --git a/includes/specials/MobileSpecialPageFeed.php 
b/includes/specials/MobileSpecialPageFeed.php
index b654720..c79a056 100644
--- a/includes/specials/MobileSpecialPageFeed.php
+++ b/includes/specials/MobileSpecialPageFeed.php
@@ -3,7 +3,7 @@
 abstract class MobileSpecialPageFeed extends MobileSpecialPage {
        public function execute( $par ) {
                $out = $this->getOutput();
-               $out->addModuleStyles( 'mobile.watchlist.styles' );
+               $out->addModuleStyles( 'mediawiki.special.pagefeed.styles' );
                $this->setHeaders();
                $out->setProperty( 'unstyledContent', true );
                parent::execute( $par );
diff --git a/includes/specials/SpecialMobileDiff.php 
b/includes/specials/SpecialMobileDiff.php
index 7580c64..00c05ae 100644
--- a/includes/specials/SpecialMobileDiff.php
+++ b/includes/specials/SpecialMobileDiff.php
@@ -87,7 +87,8 @@
 
                $output->setPageTitle( $this->msg( 
'mobile-frontend-diffview-title', $this->targetTitle->getPrefixedText() ) );
 
-               $output->addModules( 'mobile.watchlist' );
+               // FIXME: Don't add these styles. This is only needed for the 
user icon to the left of the username
+               $output->addModuleStyles( 'mediawiki.special.pagefeed.styles' );
 
                // Allow other extensions to load more stuff here
                wfRunHooks( 'BeforeSpecialMobileDiffDisplay', array( &$output, 
$ctx, $revisions ) );
diff --git a/includes/specials/SpecialMobileNotifications.php 
b/includes/specials/SpecialMobileNotifications.php
index 75b8619..cb6ef89 100644
--- a/includes/specials/SpecialMobileNotifications.php
+++ b/includes/specials/SpecialMobileNotifications.php
@@ -5,7 +5,7 @@
 class SpecialMobileNotifications extends SpecialNotifications {
        public function execute( $par ) {
                $out = $this->getOutput();
-               $out->addModuleStyles( 'mobile.notifications.special.styles' );
+               $out->addModuleStyles( 'mediawiki.special.notifications.styles' 
);
                $title = $out->getRequest()->getText( 'returnto' );
                $title = Title::newFromText( $title );
                if ( $title ) {
@@ -16,7 +16,7 @@
                        );
                }
                parent::execute( $par );
-               $out->addModules( 'mobile.notifications.special.scripts' );
+               $out->addModules( 'mediawiki.special.notifications.scripts' );
                $this->getOutput()->setProperty( 'disableSearchAndFooter', true 
);
        }
 
diff --git a/includes/specials/SpecialMobileWatchlist.php 
b/includes/specials/SpecialMobileWatchlist.php
index 64a6693..deb7666 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -40,7 +40,7 @@
 
                $user = $this->getUser();
                $output = $this->getOutput();
-               $output->addModules( 'mobile.watchlist.scripts' );
+               $output->addModules( 'skins.minerva.special.watchlist.scripts' 
);
                $req = $this->getRequest();
                $view = $req->getVal( 'watchlistview', 'a-z' );
                $this->fromPageTitle = Title::newFromText( $req->getVal( 
'from', false ) );
diff --git a/includes/specials/SpecialNearby.php 
b/includes/specials/SpecialNearby.php
index 069d309..f62f1a5 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -19,7 +19,7 @@
                // add previews to mobile only
                $ctx = MobileContext::singleton();
                if ( $ctx->shouldDisplayMobileView() && 
$ctx->isBetaGroupMember() ) {
-                       $output->addModules( 'mobile.nearby.beta' );
+                       $output->addModules( 'mediawiki.special.nearby.beta' );
                } else {
                        // Only the Minerva skin loads this module so make sure 
we load it for desktop
                        $output->addModuleStyles( 'mobile.pagelist.styles' );
diff --git a/less/specials/watchlist.less b/less/specials/pagefeed.less
similarity index 100%
rename from less/specials/watchlist.less
rename to less/specials/pagefeed.less

-- 
To view, visit https://gerrit.wikimedia.org/r/111146
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe727f345ba7ce63d1157f3a169f5267ea5b6481
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to