Jdlrobson has uploaded a new change for review.

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

Change subject: Hygiene: Componentise mobile.stable.common
......................................................................

Hygiene: Componentise mobile.stable.common

Kill some unused messages.
Split the module into logical units.
Add some deprecation notices to clean this up later.

Change-Id: Idf2a09f24da8afe40d554d7f0f732dd160d85e69
---
M includes/Resources.php
M javascripts/CtaDrawer.js
M javascripts/modules/uploads/LeadPhotoUploaderButton.js
M javascripts/modules/uploads/PhotoApi.js
M javascripts/modules/uploads/PhotoUploaderButton.js
5 files changed, 98 insertions(+), 53 deletions(-)


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

diff --git a/includes/Resources.php b/includes/Resources.php
index b452e3b..b590c7a 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -178,6 +178,8 @@
                ),
                'messages' => array(
                        'mobile-frontend-language-article-heading',
+                       // Page.js and TalkOverlay.js
+                       'mobile-frontend-talk-overlay-header',
                ),
                'templates' => array(
                        'icon.hogan' => 'templates/icon.hogan',
@@ -225,6 +227,16 @@
                        'mobile.stable.common',
                        'mobile.overlays',
                        'mediawiki.ui.input',
+               ),
+               'messages' => array(
+                       // editor.js
+                       'mobile-frontend-editor-disabled',
+                       'mobile-frontend-editor-unavailable',
+                       'mobile-frontend-editor-uploadenable',
+                       'mobile-frontend-editor-blocked',
+                       'mobile-frontend-editor-cta',
+                       'mobile-frontend-editor-anon',
+                       'mobile-frontend-editor-undo-unsupported',
                ),
                'scripts' => array(
                        'javascripts/modules/editor/editor.js',
@@ -617,8 +629,78 @@
                )
        ),
 
+       'mobile.drawers' => $wgMFResourceFileModuleBoilerplate + array(
+               'dependencies' => array(
+                       'mobile.startup',
+               ),
+               'templates' => array(
+                       'Cta.hogan' => 'templates/ctaDrawer.hogan',
+               ),
+               'scripts' => array(
+                       'javascripts/Drawer.js',
+                       'javascripts/CtaDrawer.js',
+               ),
+               'messages' => array(
+                       // CtaDrawer.js
+                       'mobile-frontend-watchlist-cta-button-signup',
+                       'mobile-frontend-watchlist-cta-button-login',
+               ),
+       ),
+
+       'mobile.toast' => $wgMFResourceFileModuleBoilerplate + array(
+               'dependencies' => array(
+                       'mobile.drawers',
+               ),
+               'scripts' => array(
+                       'javascripts/toast.js',
+               ),
+       ),
+
+       // FIXME: Only load this when uploads are enabled
+       'mobile.upload.ui' => $wgMFResourceFileModuleBoilerplate + array(
+               'dependencies' => array(
+                       'mobile.startup',
+               ),
+               'templates' => array(
+                       // FIXME: This should not be a hogan template. Use a 
txt template.
+                       'template.hogan' => 
'templates/modules/uploads/commons-upload.hogan',
+                       // PhotoUploaderButton.js
+                       'LeadButton.hogan' => 
'templates/modules/uploads/LeadPhotoUploaderButton.hogan',
+                       // @todo FIXME: this should be in special.uploads (need 
to split
+                       // code in PhotoUploaderButton.js into separate files 
too)
+                       'Button.hogan' => 
'templates/modules/uploads/PhotoUploaderButton.hogan',
+               ),
+               'scripts' => array(
+                       'javascripts/widgets/progress-bar.js',
+                       'javascripts/modules/uploads/PhotoUploaderButton.js',
+                       
'javascripts/modules/uploads/LeadPhotoUploaderButton.js',
+                       // FIXME: this seems to be uploads only, code should be 
moved to uploads folder.
+                       'javascripts/modules/routes.js',
+               ),
+               'messages' => array(
+                       // LeadPhotoUploaderButton.js
+                       'mobile-frontend-photo-upload',
+               ),
+       ),
+
+       // This module remembers that desktop site is your preference for 
viewing on a mobile phone
+       'mobile.redirect' => $wgMFResourceFileModuleBoilerplate + array(
+               'dependencies' => array(
+                       'mobile.startup',
+                       'mobile.toast',
+               ),
+               'scripts' => array(
+                       'javascripts/modules/mf-stop-mobile-redirect.js',
+               ),
+               'messages' => array(
+                       // mf-stop-mobile-redirect.js
+                       'mobile-frontend-cookies-required',
+               ),
+       ),
+
        // Important: This module is loaded on both mobile and desktop skin
-       'mobile.stable.common' => $wgMFMobileResourceBoilerplate + array(
+       // FIXME: Do not add anything to this module and please remove it
+       'mobile.stable.common' => $wgMFResourceFileModuleBoilerplate + array(
                'dependencies' => array(
                        'mobile.startup',
                        'mobile.toast.styles',
@@ -628,58 +710,17 @@
                        'mobile.overlays',
                        'jquery.cookie',
                        'mediawiki.ui.anchor',
+                       'mobile.drawers',
+                       'mobile.toast',
+                       'mobile.upload.ui',
+                       'mobile.redirect',
                ),
-               'templates' => array(
-                       'modules/uploads/commons-upload.hogan',
-                       // PhotoUploaderButton.js
-                       // For new page action menu
-                       'modules/uploads/LeadPhotoUploaderButton.hogan',
-                       // @todo FIXME: this should be in special.uploads (need 
to split
-                       // code in PhotoUploaderButton.js into separate files 
too)
-                       'modules/uploads/PhotoUploaderButton.hogan',
-
-                       'ctaDrawer.hogan',
-               ),
-               'scripts' => array(
-                       'javascripts/modules/routes.js',
-                       'javascripts/Drawer.js',
-                       'javascripts/CtaDrawer.js',
-                       'javascripts/widgets/progress-bar.js',
-                       'javascripts/toast.js',
-                       'javascripts/modules/uploads/PhotoUploaderButton.js',
-                       
'javascripts/modules/uploads/LeadPhotoUploaderButton.js',
-                       'javascripts/modules/mf-stop-mobile-redirect.js',
-               ),
+               // FIXME: Move these messages to a more appropriate place.
                'messages' => array(
-                       // mf-navigation.js
-                       'mobile-frontend-watchlist-cta-button-signup',
-                       'mobile-frontend-watchlist-cta-button-login',
-                       'mobile-frontend-drawer-cancel',
-
-                       // newbie.js
-                       'cancel',
-
-                       // page.js
-                       'mobile-frontend-talk-overlay-header',
-                       // editor.js
-                       'mobile-frontend-editor-disabled',
-                       'mobile-frontend-editor-unavailable',
-                       'mobile-frontend-editor-uploadenable',
-                       'mobile-frontend-editor-blocked',
-                       'mobile-frontend-editor-cta',
-                       'mobile-frontend-editor-anon',
+                       // editor.js, Page.js, Section.js
                        'mobile-frontend-editor-edit',
-                       'mobile-frontend-editor-undo-unsupported',
-                       // modules/editor/EditorOverlay.js
-                       // modules/talk.js
-                       // modules/uploads/PhotoUploadProgress.js
+                       // EditorOverlayBase.js, TalkSectionAddOverlay, 
TalkSectionOverlay, PhotoUploadProgress
                        'mobile-frontend-editor-save',
-                       // PageApi.js
-                       'mobile-frontend-last-modified-with-user-date',
-                       // mf-stop-mobile-redirect.js
-                       'mobile-frontend-cookies-required',
-                       // LeadPhotoUploaderButton.js
-                       'mobile-frontend-photo-upload',
                ),
        ),
 
@@ -717,6 +758,10 @@
                'dependencies' => array(
                        'mobile.overlays',
                ),
+               'messages' => array(
+                       // PageActionOverlay.js
+                       'cancel',
+               ),
                'scripts' => array(
                        'javascripts/modules/tutorials/ContentOverlay.js',
                        'javascripts/modules/tutorials/PageActionOverlay.js',
diff --git a/javascripts/CtaDrawer.js b/javascripts/CtaDrawer.js
index dd90bb7..639515c 100644
--- a/javascripts/CtaDrawer.js
+++ b/javascripts/CtaDrawer.js
@@ -16,7 +16,7 @@
                        loginCaption: mw.msg( 
'mobile-frontend-watchlist-cta-button-login' ),
                        signupCaption: mw.msg( 
'mobile-frontend-watchlist-cta-button-signup' )
                },
-               template: M.template.get( 'ctaDrawer.hogan' ),
+               template: mw.template.get( 'mobile.drawers', 'Cta.hogan' ),
 
                preRender: function ( options ) {
                        var params = $.extend( {
diff --git a/javascripts/modules/uploads/LeadPhotoUploaderButton.js 
b/javascripts/modules/uploads/LeadPhotoUploaderButton.js
index 3792237..2a59b6f 100644
--- a/javascripts/modules/uploads/LeadPhotoUploaderButton.js
+++ b/javascripts/modules/uploads/LeadPhotoUploaderButton.js
@@ -11,7 +11,7 @@
         * @extends PhotoUploaderButton
         */
        LeadPhotoUploaderButton = PhotoUploaderButton.extend( {
-               template: M.template.get( 
'modules/uploads/LeadPhotoUploaderButton.hogan' ),
+               template: mw.template.get( 'mobile.upload.ui', 
'LeadButton.hogan' ),
                className: uploadIcon.getClassName(),
 
                defaults: {
diff --git a/javascripts/modules/uploads/PhotoApi.js 
b/javascripts/modules/uploads/PhotoApi.js
index b2e5bd1..9f16636 100644
--- a/javascripts/modules/uploads/PhotoApi.js
+++ b/javascripts/modules/uploads/PhotoApi.js
@@ -160,7 +160,7 @@
                                        comment: mw.msg( 
options.editSummaryMessage ),
                                        file: options.file,
                                        token: token,
-                                       text: M.template.get( 
'modules/uploads/commons-upload.hogan' ).
+                                       text: mw.template.get( 
'mobile.upload.ui', 'template.hogan' ).
                                                render( {
                                                        suffix: mw.config.get( 
'wgMFPhotoUploadAppendToDesc' ),
                                                        text: 
options.description,
diff --git a/javascripts/modules/uploads/PhotoUploaderButton.js 
b/javascripts/modules/uploads/PhotoUploaderButton.js
index 9ec3111..d7ef58c 100644
--- a/javascripts/modules/uploads/PhotoUploaderButton.js
+++ b/javascripts/modules/uploads/PhotoUploaderButton.js
@@ -47,7 +47,7 @@
         * @param {string} options.funnel Funnel for EventLogging.
         */
        PhotoUploaderButton = View.extend( {
-               template: M.template.get( 
'modules/uploads/PhotoUploaderButton.hogan' ),
+               template: mw.template.get( 'mobile.upload.ui', 'Button.hogan' ),
                className: photoIcon.getClassName(),
 
                postRender: function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf2a09f24da8afe40d554d7f0f732dd160d85e69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to