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

Change subject: Hygiene: Make Infobox use View##events
......................................................................


Hygiene: Make Infobox use View##events

Bug: T88565
Change-Id: I66785b5cbd0f1036fadc0f9640ae880bc15635de
---
M javascripts/modules/infobox/Infobox.js
1 file changed, 14 insertions(+), 10 deletions(-)

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



diff --git a/javascripts/modules/infobox/Infobox.js 
b/javascripts/modules/infobox/Infobox.js
index 822bb8d..b06aa1a 100644
--- a/javascripts/modules/infobox/Infobox.js
+++ b/javascripts/modules/infobox/Infobox.js
@@ -62,6 +62,10 @@
                        rows: []
                },
                typeDefaults: mw.config.get( 'wgMFInfoboxConfig' ),
+               /** @inheritdoc */
+               events: {
+                       'click .more': 'onExpandInfobox'
+               },
                /**
                 * Given a title work out the url to the thumbnail for that 
image
                 * FIXME: This should not make its way into stable.
@@ -318,20 +322,20 @@
                /**
                 * @inheritdoc
                 */
-               postRender: function ( options ) {
-                       var _postRender = this.postRender,
-                               _emit = this.emit,
-                               self = this;
-
+               postRender: function () {
                        if ( user.isAnon() ) {
                                this.$( '.edit' ).remove();
                        }
                        this.$( '.spinner' ).hide();
-                       this.$( '.more' ).on( 'click', function () {
-                               $( this ).remove();
-                               _emit.call( self, 'load' );
-                               _postRender.call( self, options );
-                       } );
+               },
+               /**
+                * Event handler that runs when the more button is clicked.
+                * @param {jQuery.Event} ev
+                */
+               onExpandInfobox: function ( ev ) {
+                       $( ev.target ).remove();
+                       this.emit( 'load' );
+                       this.postRender( this.options );
                },
                /**
                 * Decides based on the type of item what infobox to render

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

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

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

Reply via email to