jenkins-bot has submitted this change and it was merged.

Change subject: Load correct page actions images
......................................................................


Load correct page actions images

Hide page action icons on page load and then show once the correct
classes have been added. Also cache jquery selectors.

Take care of the issues at I359eaa45d82193ac3133daa425d83c3e4b0c1fea

Bug: T74851
Change-Id: Ideb4398c203fb7a10bac8a32e0862013202d0f68
---
M includes/skins/SkinMinerva.php
M javascripts/modules/editor/init.js
M javascripts/modules/uploads/PhotoUploaderButton.js
M javascripts/modules/watchstar/Watchstar.js
4 files changed, 23 insertions(+), 9 deletions(-)

Approvals:
  Phuedx: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 3ad8ac4..37f197a 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -778,7 +778,7 @@
                if ( $this->isAllowedPageAction( 'edit' ) ) {
                        $menu['edit'] = array( 'id' => 'ca-edit', 'text' => '',
                                'itemtitle' => $this->msg( 
'mobile-frontend-pageaction-edit-tooltip' ),
-                               'class' => MobileUI::iconClass( 'edit', 
'element', 'icon-32px' ),
+                               'class' => MobileUI::iconClass( 'edit', 
'element', 'icon-32px hidden' ),
                        );
                }
 
@@ -789,14 +789,15 @@
                ) {
                        $menu['photo'] = array( 'id' => 'ca-upload', 'text' => 
'',
                                'itemtitle' => $this->msg( 
'mobile-frontend-pageaction-upload-tooltip' ),
-                               'class' => MobileUI::iconClass( 'addimage', 
'element', 'icon-32px' ),
+                               'class' => MobileUI::iconClass( 'addimage', 
'element', 'icon-32px hidden' ),
                        );
                }
 
                if ( $this->isAllowedPageAction( 'watch' ) ) {
                        $watchTemplate = array(
                                'id' => 'ca-watch',
-                               'class' => MobileUI::iconClass( 'watch', 
'element', 'icon-32px watch-this-article' ),
+                               'class' => MobileUI::iconClass( 'watch', 
'element',
+                                       'icon-32px watch-this-article hidden' ),
                        );
                        // standardise watch article into one menu item
                        if ( isset( $actions['watch'] ) ) {
diff --git a/javascripts/modules/editor/init.js 
b/javascripts/modules/editor/init.js
index e520707..ba1aaf3 100644
--- a/javascripts/modules/editor/init.js
+++ b/javascripts/modules/editor/init.js
@@ -34,7 +34,8 @@
                                returntoquery: 'article_action=signup-edit'
                        },
                        content: mw.msg( 'mobile-frontend-editor-cta' )
-               } );
+               } ),
+               $caEdit = $( '#ca-edit' );
 
        if ( pendingToast ) {
                // delete the pending toast
@@ -177,11 +178,11 @@
 
                        return result;
                } );
-               $( '#ca-edit' ).addClass( enabledClass ).removeClass( 
disabledClass );
+               $caEdit.addClass( enabledClass ).removeClass( disabledClass 
).removeClass( 'hidden' );
 
                // Make sure we never create two edit links by accident
                // FIXME: split the selector and cache it
-               if ( $( '#ca-edit .edit-page' ).length === 0 ) {
+               if ( $caEdit.find( '.edit-page' ).length === 0 ) {
                        // FIXME: unfortunately the main page is special cased.
                        if ( mw.config.get( 'wgIsMainPage' ) || isNewPage || 
page.getLeadSectionElement().text() ) {
                                // if lead section is not empty, open editor 
with lead section
@@ -207,6 +208,7 @@
                if ( currentPage.isEditable( user ) ) {
                        setupEditor( currentPage );
                } else {
+                       $caEdit.removeClass( 'hidden' );
                        showSorryToast( 'mobile-frontend-editor-disabled' );
                }
        }
@@ -220,9 +222,9 @@
                // Initialize edit button links (to show Cta) only, if page is 
editable,
                // otherwise show an error toast
                if ( currentPage.isEditable( user ) ) {
-                       $( '#ca-edit' ).addClass( enabledClass ).removeClass( 
disabledClass );
+                       $caEdit.addClass( enabledClass ).removeClass( 
disabledClass ).removeClass( 'hidden' );
                        // Init lead section edit button
-                       makeCta( $( '#ca-edit' ), 0 );
+                       makeCta( $caEdit, 0 );
 
                        // Init all edit links (including lead section, if 
anonymous editing is enabled)
                        $( '.edit-page' ).each( function () {
@@ -235,6 +237,7 @@
                                makeCta( $a, section );
                        } );
                } else {
+                       $caEdit.removeClass( 'hidden' );
                        showSorryToast( 'mobile-frontend-editor-disabled' );
                }
        }
@@ -253,8 +256,10 @@
 
        if ( !isEditingSupported ) {
                // Editing is disabled (or browser is blacklisted)
+               $caEdit.removeClass( 'hidden' );
                showSorryToast( 'mobile-frontend-editor-unavailable' );
        } else if ( isNewFile ) {
+               $caEdit.removeClass( 'hidden' );
                // Is a new file page (enable upload image only) Bug 58311
                showSorryToast( 'mobile-frontend-editor-uploadenable' );
        } else {
@@ -267,6 +272,7 @@
                        }
                } else {
                        if ( mw.config.get( 'wgMFIsLoggedInUserBlocked' ) ) {
+                               $caEdit.removeClass( 'hidden' );
                                // User is blocked. Both anonymous and logged 
in users can be blocked.
                                showSorryToast( 
'mobile-frontend-editor-blocked' );
                        } else {
diff --git a/javascripts/modules/uploads/PhotoUploaderButton.js 
b/javascripts/modules/uploads/PhotoUploaderButton.js
index 850a899..1718119 100644
--- a/javascripts/modules/uploads/PhotoUploaderButton.js
+++ b/javascripts/modules/uploads/PhotoUploaderButton.js
@@ -52,14 +52,20 @@
                        // clear so that change event is fired again when user 
selects the same file
                        $input.val( '' );
                },
+
                /**
                 * Handle a selected file for upload, emit event and route to 
the
-                * appropiate url
+                * appropriate url
                 */
                handleFile: function ( file ) {
                        // FIXME: this is hacky but it would be hard to pass a 
file in a route
                        M.emit( '_upload-preview', file );
                        M.router.navigate( '#/upload-preview/' + 
this.options.funnel );
+               },
+
+               /** @inheritdoc */
+               postRender: function () {
+                       this.$el.removeClass( 'hidden' );
                }
        } );
 
diff --git a/javascripts/modules/watchstar/Watchstar.js 
b/javascripts/modules/watchstar/Watchstar.js
index aa83fec..341b7aa 100644
--- a/javascripts/modules/watchstar/Watchstar.js
+++ b/javascripts/modules/watchstar/Watchstar.js
@@ -89,6 +89,7 @@
                        } else {
                                $el.addClass( unwatchedClass ).removeClass( 
watchedClass );
                        }
+                       $el.removeClass( 'hidden' );
                },
 
                /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ideb4398c203fb7a10bac8a32e0862013202d0f68
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to