JGonera has submitted this change and it was merged.

Change subject: Bug 30405: Don't special case homepage HTML in alpha
......................................................................


Bug 30405: Don't special case homepage HTML in alpha

Because it's always been horrible.
Start trying to find other inventive ways using css to fix problem

Disable table module on homepage (as tables are frequently used in
this context)

I've been walkin' these streets so long
Singin' the same old song
I know every crack in these dirty sidewalks of Broadway

Where hustle's the name of the game
And nice guys get washed away
Like the snow and the rain

There's been a load of compromisin'
On the road to my horizon
But I'm gonna be where the lights are shinin' on me

Like a rhinestone cowboy
Riding out on a horse in a star-spangled rodeo

Bug: 30405

Change-Id: I444b061796b3e3344852327cf26b48e83381f457
---
M MobileFrontend.php
M includes/MobileFrontend.body.php
M includes/skins/SkinMobile.php
M javascripts/modules/mf-tables.js
A less/mainpage/mainpage.less
A stylesheets/mainpage/mainpage.css
6 files changed, 79 insertions(+), 5 deletions(-)

Approvals:
  JGonera: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/MobileFrontend.php b/MobileFrontend.php
index e3a83a3..8c212fc 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -168,6 +168,35 @@
        'class' => 'MFResourceLoaderModule',
 );
 
+// main page
+$wgResourceModules['mobile.mainpage.styles'] = $wgMFMobileResourceBoilerplate 
+ array(
+       'dependencies' => array( 'mobile.startup' ),
+       'styles' => array(
+               'stylesheets/mainpage/mainpage.css',
+       ),
+       'group' => 'other',
+);
+
+$wgResourceModules['mobile.mainpage.dependencies'] = array(
+       'messages' => array(
+               // mf-homepage.js
+               'mobile-frontend-empty-homepage-text' => array( 'parse' ),
+       ),
+       'class' => 'MFResourceLoaderModule',
+       'group' => 'other',
+);
+
+$wgResourceModules['mobile.mainpage.scripts'] = $wgMFMobileResourceBoilerplate 
+ array(
+       'dependencies' => array(
+               'mobile.startup',
+               'mobile.mainpage.dependencies',
+       ),
+       'scripts' => array(
+               'javascripts/modules/mf-homepage.js',
+       ),
+       'group' => 'other',
+);
+
 // Filepages
 $wgResourceModules['mobile.file.styles'] = $wgMFMobileResourceBoilerplate + 
array(
        'dependencies' => array( 'mobile.startup' ),
@@ -222,8 +251,6 @@
 
 $wgResourceModules['mobile.stable.dependencies'] = array(
        'messages' => array(
-               // mf-homepage.js
-               'mobile-frontend-empty-homepage-text' => array( 'parse' ),
                // mf-photo.js
                'mobile-frontend-photo-license' => array( 'parse' ),
        ),
@@ -400,7 +427,7 @@
                'javascripts/common/mf-view.js',
                'javascripts/widgets/progress-bar.js',
                'javascripts/common/mf-navigation.js',
-               'javascripts/common/mf-notification.js', 
'javascripts/modules/mf-homepage.js',
+               'javascripts/common/mf-notification.js',
                'javascripts/modules/mf-cleanuptemplates.js',
                'javascripts/modules/mf-last-modified.js',
                'javascripts/modules/mf-watchstar.js',
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 9c5f58f..78ee268 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -168,7 +168,10 @@
                }
 
                wfProfileIn( __METHOD__ . '-getText' );
-               $formatter->setIsMainPage( $this->getTitle()->isMainPage() );
+               if ( !$context->isAlphaGroupMember() ) {
+                       $formatter->setIsMainPage( 
$this->getTitle()->isMainPage() );
+               }
+
                if ( $context->getContentFormat() == 'HTML'
                        && $this->getRequest()->getText( 'search' ) == '' )
                {
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 6423579..fd997a1 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -294,6 +294,14 @@
                        $out->addModuleStyles( 'mobile.styles.page' );
                }
 
+               if ( $title->isMainPage() ) {
+                       if ( $context->isAlphaGroupMember() ) {
+                               $out->addModuleStyles( 'mobile.mainpage.styles' 
);
+                       } else {
+                               $out->addModules( 'mobile.mainpage.scripts' );
+                       }
+               }
+
                if ( $action === 'edit' ) {
                        $out->addModules( 'mobile.action.edit' );
                } else if ( $action === 'history' ) {
diff --git a/javascripts/modules/mf-tables.js b/javascripts/modules/mf-tables.js
index a7f4b95..be57d7f 100644
--- a/javascripts/modules/mf-tables.js
+++ b/javascripts/modules/mf-tables.js
@@ -3,7 +3,7 @@
 ( function() {
        var STEP_SIZE = 150;
 
-       function initTables( $container ) {
+       function collapseTables( $container ) {
                var nav = M.require( 'navigation' ),
                        $tables = $container ? $container.find( 'table' ) : $( 
'table' );
 
@@ -53,6 +53,12 @@
                } );
        }
 
+       function initTables( $container ) {
+               if ( !mw.config.get( 'wgIsMainPage' ) ) {
+                       collapseTables( $container );
+               }
+       }
+
        M.
                on( 'page-loaded', function() {
                        initTables( $( '#content_0' ) );
diff --git a/less/mainpage/mainpage.less b/less/mainpage/mainpage.less
new file mode 100644
index 0000000..52333c4
--- /dev/null
+++ b/less/mainpage/mainpage.less
@@ -0,0 +1,19 @@
+body.page-Main_Page {
+
+       table {
+               tr,
+               td {
+                       display: block !important;
+                       ul {
+                               li {
+                                       display: inline;
+                               }
+                       }
+               }
+               .section_heading {
+                       button {
+                               display: none !important;
+                       }
+               }
+       }
+}
diff --git a/stylesheets/mainpage/mainpage.css 
b/stylesheets/mainpage/mainpage.css
new file mode 100644
index 0000000..da23d0f
--- /dev/null
+++ b/stylesheets/mainpage/mainpage.css
@@ -0,0 +1,11 @@
+body.page-Main_Page table tr,
+body.page-Main_Page table td {
+  display: block !important;
+}
+body.page-Main_Page table tr ul li,
+body.page-Main_Page table td ul li {
+  display: inline;
+}
+body.page-Main_Page table .section_heading button {
+  display: none !important;
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I444b061796b3e3344852327cf26b48e83381f457
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to