Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/185849
Change subject: Hygiene: UploadTutorial should use events map
......................................................................
Hygiene: UploadTutorial should use events map
Change-Id: Ia7867a649cf88ed8728db5d68e2a9a6d4331fc63
---
M javascripts/modules/uploads/UploadTutorial.js
1 file changed, 22 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/49/185849/1
diff --git a/javascripts/modules/uploads/UploadTutorial.js
b/javascripts/modules/uploads/UploadTutorial.js
index 101c7c2..5e7ce36 100644
--- a/javascripts/modules/uploads/UploadTutorial.js
+++ b/javascripts/modules/uploads/UploadTutorial.js
@@ -18,6 +18,12 @@
template: mw.template.get( 'mobile.uploads',
'UploadTutorial.hogan' ),
className: 'overlay carousel tutorial content-overlay',
+ /** @inheritdoc */
+ events: {
+ 'click .prev': 'onPreviousClick',
+ 'click .next': 'onNextClick',
+ 'click .button': 'onClickUploadButton'
+ },
/**
* @inheritdoc
* @cfg {Object} defaults Default options hash.
@@ -68,20 +74,11 @@
buttonCaption: buttonMsg,
funnel: options.funnel
} );
- $button.on( 'click', function () {
- // need timeout for the file dialog to
open
- setTimeout( $.proxy( self, 'hide' ), 0
);
- setTimeout( $.proxy( self, 'emit',
'hide' ), 0 );
- } );
}
this.page = 0;
this.totalPages = options.pages.length;
- this.$( '.prev' ).on( 'click', $.proxy( this,
'previous' ) );
- this.$( '.next' ).on( 'click', $.proxy( this, 'next' )
);
-
this._showCurrentPage();
-
Overlay.prototype.postRender.apply( this, arguments );
},
@@ -97,10 +94,24 @@
},
/**
+ * Event that is fired when clicking the final button at the
end of the tutorial.
+ * @method
+ */
+ onClickUploadButton: function () {
+ var self = this;
+ // Check if funnel otherwise they are just viewing the
tutorial (didn't click button beforehand).
+ if ( options.funnel ) {
+ // need timeout for the file dialog to open
+ setTimeout( $.proxy( self, 'hide' ), 0 );
+ setTimeout( $.proxy( self, 'emit', 'hide' ), 0
);
+ }
+ },
+
+ /**
* Show next page of the tutorial
* @method
*/
- next: function () {
+ onNextClick: function () {
this.page += 1;
this._showCurrentPage();
},
@@ -109,7 +120,7 @@
* Show previous page of the tutorial
* @method
*/
- previous: function () {
+ onPreviousClick: function () {
this.page -= 1;
this._showCurrentPage();
}
--
To view, visit https://gerrit.wikimedia.org/r/185849
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7867a649cf88ed8728db5d68e2a9a6d4331fc63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits