Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180900

Change subject: Hygiene: Photo upload overlay documentation
......................................................................

Hygiene: Photo upload overlay documentation

Change-Id: I55569bf545fab4392378a1fe7496b129e9d9b73d
---
M javascripts/modules/uploads/PhotoUploadOverlay.js
1 file changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/00/180900/1

diff --git a/javascripts/modules/uploads/PhotoUploadOverlay.js 
b/javascripts/modules/uploads/PhotoUploadOverlay.js
index d7cb3eb..7c57dac 100644
--- a/javascripts/modules/uploads/PhotoUploadOverlay.js
+++ b/javascripts/modules/uploads/PhotoUploadOverlay.js
@@ -13,6 +13,7 @@
        /**
         * Overlay for photo upload
         * @class PhotoUploadOverlay
+        * @uses PhotoApi
         * @extends Overlay
         */
        PhotoUploadOverlay = Overlay.extend( {
@@ -58,6 +59,10 @@
 
                        if ( this.file ) {
                                fileReader.readAsDataURL( options.file );
+                               /**
+                                * onload event for FileReader
+                                * @ignore
+                                */
                                fileReader.onload = function () {
                                        var dataUri = fileReader.result;
                                        // add mimetype if not present (some 
browsers need it, e.g. Android browser)
@@ -109,6 +114,13 @@
                        Overlay.prototype.initialize.apply( this, arguments );
                },
 
+               /**
+                * Performs a file upload based on current state of 
PhotoUploadOverlay
+                * When succeeds either reloads page or emits a global event 
_file-upload
+                * If error occurs shows a toast
+                * @uses PhotoApi
+                * @private
+                */
                _save: function () {
                        var
                                self = this,
@@ -130,7 +142,11 @@
                                        // reload the page
                                        window.location.reload();
                                } else {
-                                       // FIXME: handle Special:Uploads case - 
find more generic way of doing this
+                                       /**
+                                        * @event _file-upload
+                                        * Emits global event _file-upload.
+                                        * FIXME: handle Special:Uploads case - 
find more generic way of doing this
+                                        */
                                        M.emit( '_file-upload', {
                                                fileName: fileName,
                                                description: description,
@@ -172,6 +188,11 @@
                        } );
                },
 
+               /**
+                * Submits a photo for upload, reveals a progress bar and hides 
the overlay.
+                * Invokes _save method.
+                * @private
+                */
                _submit: function () {
                        this.hide( true );
 
@@ -253,10 +274,19 @@
                        }
                },
 
+               /**
+                * Gets the user inputted description
+                * @returns {String} of current value of description according 
to view
+                */
                getDescription: function () {
                        return this.$description.val();
                },
 
+               /**
+                * Set the url of the image in the preview.
+                * Throws toast if for some reason image cannot render e.g. bad 
file type.
+                * @param {String} url usually a data uri
+                */
                setImageUrl: function ( url ) {
                        var self = this,
                                $preview = this.$( '.preview' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I55569bf545fab4392378a1fe7496b129e9d9b73d
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

Reply via email to