Hygiene: migrate View.events to constructor prop

Migrate View.events to constructor property. MobileFrontend supports
both the deprecated View.prototype.events and recently passing events as
an argument at construction (see dependent patch).

As a client, Minerva doesn't provide nearly so many extensible classes
as MobileFrontend. The classes changed in this patch are no different so
events are not expected to be extended.

Bug: T208915
Depends-On: Ic193e97b4cd6f72d226bd9768e904bdec168ba39
Change-Id: I68923e2dfd4b2f3e3f3de5185e9b65ab0b665ab7
This commit is contained in:
Stephen Niedzielski 2019-02-05 13:54:10 -07:00 committed by Jdlrobson
parent 210758b550
commit 0dfdbadb4b
2 changed files with 4 additions and 7 deletions

View File

@ -12,16 +12,14 @@
function BackToTopOverlay( props ) { function BackToTopOverlay( props ) {
View.call( this, View.call( this,
util.extend( {}, props, { util.extend( {}, props, {
className: 'backtotop' className: 'backtotop',
events: { click: 'onBackToTopClick' }
} ) } )
); );
} }
OO.mfExtend( BackToTopOverlay, View, { OO.mfExtend( BackToTopOverlay, View, {
template: mw.template.get( 'skins.minerva.options', 'BackToTopOverlay.hogan' ), template: mw.template.get( 'skins.minerva.options', 'BackToTopOverlay.hogan' ),
events: $.extend( {}, View.prototype.events, {
click: 'onBackToTopClick'
} ),
/** /**
* Show the back to top element, if it's not visible already. * Show the back to top element, if it's not visible already.

View File

@ -12,7 +12,6 @@
Icon = M.require( 'mobile.startup/Icon' ), Icon = M.require( 'mobile.startup/Icon' ),
Button = M.require( 'mobile.startup/Button' ), Button = M.require( 'mobile.startup/Button' ),
Anchor = M.require( 'mobile.startup/Anchor' ), Anchor = M.require( 'mobile.startup/Anchor' ),
util = M.require( 'mobile.startup/util' ),
overlayManager = OverlayManager.getSingleton(), overlayManager = OverlayManager.getSingleton(),
page = M.getCurrentPage(), page = M.getCurrentPage(),
api = new mw.Api(), api = new mw.Api(),
@ -301,9 +300,9 @@
label: mw.msg( 'mobile-frontend-editor-redlink-leave' ), label: mw.msg( 'mobile-frontend-editor-redlink-leave' ),
additionalClassNames: 'hide' additionalClassNames: 'hide'
} ).options, } ).options,
events: util.extend( {}, CtaDrawer.prototype.events, { events: {
'click .hide': 'hide' // Call CtaDrawer.hide() on closeAnchor click. 'click .hide': 'hide' // Call CtaDrawer.hide() on closeAnchor click.
} ), },
content: mw.msg( 'mobile-frontend-editor-redlink-explain' ), content: mw.msg( 'mobile-frontend-editor-redlink-explain' ),
actionAnchor: false actionAnchor: false
}, },