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

Change subject: Hygiene: Document methods in uploads folder
......................................................................


Hygiene: Document methods in uploads folder

Change-Id: Ib45b2639936db8fd61ff2a98db21b11f51b9af82
---
M javascripts/specials/uploads/PhotoList.js
M javascripts/specials/uploads/UserGalleryApi.js
M javascripts/specials/uploads/init.js
3 files changed, 49 insertions(+), 0 deletions(-)

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



diff --git a/javascripts/specials/uploads/PhotoList.js 
b/javascripts/specials/uploads/PhotoList.js
index adb809b..85b350a 100644
--- a/javascripts/specials/uploads/PhotoList.js
+++ b/javascripts/specials/uploads/PhotoList.js
@@ -42,31 +42,66 @@
                        // e.g. 
http://benalman.com/projects/jquery-throttle-debounce-plugin/
                        $( window ).on( 'scroll', $.proxy( this, '_loadPhotos' 
) );
                },
+               /**
+                * Check to see if the current view is an empty list.
+                * @return {Boolean} whether no images have been rendered
+                */
                isEmpty: function () {
                        return this.$list.find( 'li' ).length === 0;
                },
+               /**
+                * Renders an empty message prior to the list.
+                * FIXME: Should be handled in template, not a method.
+                */
                showEmptyMessage: function () {
                        $( '<p class="content empty">' ).text( mw.msg( 
'mobile-frontend-donate-image-nouploads' ) )
                                .insertBefore( this.$list );
                },
+               /**
+                * Hides the message saying the list is empty
+                * FIXME: Should be handled in template, not a method.
+                */
                hideEmptyMessage: function () {
                        this.$( '.empty' ).remove();
                },
+               /**
+                * Prepend a photo to the view.
+                * @param {Object} photoData Options describing a new 
{PhotoItem}
+                * FIXME: Code duplication with PhotoList::appendPhoto
+                */
                prependPhoto: function ( photoData ) {
                        photoData.width = this.api.getWidth();
                        var photoItem = new PhotoItem( photoData ).prependTo( 
this.$list );
                        this.hideEmptyMessage();
                        M.emit( 'photo-loaded', photoItem.$el );
                },
+               /**
+                * Append a photo to the view.
+                * @param {Object} photoData Options describing a new 
{PhotoItem}
+                */
                appendPhoto: function ( photoData ) {
                        var photoItem = new PhotoItem( photoData ).appendTo( 
this.$list );
                        this.hideEmptyMessage();
+                       /**
+                        * @event photo-loaded
+                        * @param {jQuery.Object} element belonging to view
+                        * Fired when a new {PhotoItem} has been added to the 
current view.
+                        */
                        M.emit( 'photo-loaded', photoItem.$el );
                },
+               /**
+                * Check if the user has scrolled near the end of the list.
+                * @private
+                * @return {Boolean}
+                */
                _isEndNear: function () {
                        var scrollBottom = $( window ).scrollTop() + $( window 
).height();
                        return scrollBottom + this.threshold > 
this.$end.offset().top;
                },
+               /**
+                * Load photos into the view using {{UserGalleryApi}} when the 
end is near
+                *  and no current API requests are underway.
+                */
                _loadPhotos: function () {
                        var self = this;
 
diff --git a/javascripts/specials/uploads/UserGalleryApi.js 
b/javascripts/specials/uploads/UserGalleryApi.js
index 734d88a..7f06ef5 100644
--- a/javascripts/specials/uploads/UserGalleryApi.js
+++ b/javascripts/specials/uploads/UserGalleryApi.js
@@ -56,6 +56,10 @@
                                descriptionUrl: img.descriptionurl
                        };
                },
+               /**
+                * Request photos beginning with the current value of 
endTimestamp
+                * @return {jQuery.Deferred} where parameter is a list of 
JavaScript objects describing an image.
+                */
                getPhotos: function () {
                        var self = this,
                                result = $.Deferred();
@@ -95,6 +99,7 @@
                                                } else {
                                                        self.endTimestamp = 
false;
                                                }
+                                               // FIXME: Should reply with a 
list of PhotoItem or Photo classes.
                                                result.resolve( photos );
                                        } else {
                                                result.resolve( [] );
diff --git a/javascripts/specials/uploads/init.js 
b/javascripts/specials/uploads/init.js
index 7435ef0..7e20223 100644
--- a/javascripts/specials/uploads/init.js
+++ b/javascripts/specials/uploads/init.js
@@ -8,6 +8,11 @@
                currentUserName = user.getName(),
                userName = pageParams[1] ? pageParams[1] : currentUserName;
 
+       /**
+        * Create a {PhotoUploaderButton} with an uploads funnel.
+        * @param {jQuery.Object} $container to append new button to.
+        * @ignore
+        */
        function createButton( $container ) {
                var btn = new PhotoUploaderButton( {
                        buttonCaption: mw.msg( 
'mobile-frontend-photo-upload-generic' ),
@@ -18,6 +23,10 @@
                btn.appendTo( $container );
        }
 
+       /**
+        * Initialise a photo upload button at the top of the page.
+        * @ignore
+        */
        function init() {
                var userGallery, $a,
                        $container = $( '.ctaUploadPhoto' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib45b2639936db8fd61ff2a98db21b11f51b9af82
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to