Jdlrobson has uploaded a new change for review.

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


Change subject: Make special pages declare their modules
......................................................................

Make special pages declare their modules

Remove code to do this in SkinMobile
FIXME: Not sure how to add modules for Special:UserLogin page ..

Change-Id: Ifbd50a459e71b90ad662064486f3d1d329d9df7e
---
M includes/skins/SkinMobile.php
M includes/specials/SpecialMobileMenu.php
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/UnlistedSpecialMobilePage.php
4 files changed, 23 insertions(+), 20 deletions(-)


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

diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 9a0c6d1..9441043 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -358,25 +358,7 @@
                        $headModuleNames[] = 'mobile.file.styles';
                }
 
-               if ( $isSpecialPage ) {
-                       list( $name, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
-                       $id = strtolower( $name );
-                       $specialStyleModuleName = 'mobile.' . $id . '.styles';
-                       $specialScriptModuleName = 'mobile.' . $id . '.scripts';
-
-                       if ( isset( $wgResourceModules[ $specialStyleModuleName 
] ) ) {
-                               $headModuleNames[] = $specialStyleModuleName;
-                       }
-
-                       if ( isset( $wgResourceModules[ 
$specialScriptModuleName ] ) ) {
-                               $module = $wgResourceModules[ 
$specialScriptModuleName ];
-                               if ( isset( $module['position'] ) && 
$module['position'] === 'top' ) {
-                                       $headModuleNames[] = 
$specialScriptModuleName;
-                               } else {
-                                       $moduleNames[] = 
$specialScriptModuleName;
-                               }
-                       }
-               } else {
+               if ( !$isSpecialPage ) {
                        $headModuleNames[] = 'mobile.styles.page';
                }
 
diff --git a/includes/specials/SpecialMobileMenu.php 
b/includes/specials/SpecialMobileMenu.php
index 54324a3..ebcbaa3 100644
--- a/includes/specials/SpecialMobileMenu.php
+++ b/includes/specials/SpecialMobileMenu.php
@@ -1,6 +1,6 @@
 <?php
 
-class SpecialMobileMenu extends UnlistedSpecialPage {
+class SpecialMobileMenu extends UnlistedSpecialMobilePage {
        public function __construct() {
                parent::__construct( 'MobileMenu' );
        }
diff --git a/includes/specials/SpecialMobileWatchlist.php 
b/includes/specials/SpecialMobileWatchlist.php
index e3288e2..5555a67 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -24,6 +24,8 @@
 
                $user = $this->getUser();
                $output = $this->getOutput();
+               $output->addModuleStyles( 'mobile.watchlist.styles' );
+               $output->addModules( 'mobile.watchlist.scripts' );
                $req = $this->getRequest();
                $view = $req->getVal( 'watchlistview', 'a-z' );
                $this->fromPageTitle = Title::newFromText( $req->getVal( 
'from', false ) );
diff --git a/includes/specials/UnlistedSpecialMobilePage.php 
b/includes/specials/UnlistedSpecialMobilePage.php
index 575d7e8..b28f198 100644
--- a/includes/specials/UnlistedSpecialMobilePage.php
+++ b/includes/specials/UnlistedSpecialMobilePage.php
@@ -4,6 +4,25 @@
        public function __construct( $name, $restriction = '', $function = 
false, $file = 'default' ) {
                parent::__construct( $name, $restriction, false, $function, 
$file );
                $this->clearPageMargins();
+               $this->addModules( $name );
+       }
+
+       public function addModules( $name ) {
+               global $wgResourceModules;
+               $out = $this->getOutput();
+               $title = $this->getTitle();
+               list( $name, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
+               $id = strtolower( $name );
+               $specialStyleModuleName = 'mobile.' . $id . '.styles';
+               $specialScriptModuleName = 'mobile.' . $id . '.scripts';
+
+               if ( isset( $wgResourceModules[ $specialStyleModuleName ] ) ) {
+                       $out->addModuleStyles( $specialStyleModuleName );
+               }
+
+               if ( isset( $wgResourceModules[ $specialScriptModuleName ] ) ) {
+                       $out->addModules( $specialScriptModuleName );
+               }
        }
 
        public function clearPageMargins() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbd50a459e71b90ad662064486f3d1d329d9df7e
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