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

Change subject: Move the rest of detailsSubmit to the controller
......................................................................


Move the rest of detailsSubmit to the controller

Bug: T90771
Change-Id: I936cf4c99c9020f3bfe553c884ade43625b20cfa
---
M resources/controller/uw.controller.Details.js
M resources/controller/uw.controller.Step.js
M resources/mw.UploadWizard.js
M resources/ui/uw.ui.Step.js
4 files changed, 12 insertions(+), 24 deletions(-)

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



diff --git a/resources/controller/uw.controller.Details.js 
b/resources/controller/uw.controller.Details.js
index 1b75bfc..a888ee6 100644
--- a/resources/controller/uw.controller.Details.js
+++ b/resources/controller/uw.controller.Details.js
@@ -198,9 +198,11 @@
 
        /**
         * Submit details to the API.
-        * @TODO move the actual submission here - need to fiddle with 
makeTransitioner first
+        * @returns {jQuery.Promise}
         */
        DP.submit = function () {
+               var details = this;
+
                $.each( this.uploads, function ( i, upload ) {
                        // Skip empty uploads
                        if ( upload === undefined ) {
@@ -221,6 +223,11 @@
 
                // Hide errors (maybe this submission fixes them)
                this.ui.hideErrors();
+
+               return this.transitionAll().then( function () {
+                       details.showErrors();
+                       details.emit( 'details-submitted' );
+               } );
        };
 
        /**
diff --git a/resources/controller/uw.controller.Step.js 
b/resources/controller/uw.controller.Step.js
index 1ea5840..eed11a2 100644
--- a/resources/controller/uw.controller.Step.js
+++ b/resources/controller/uw.controller.Step.js
@@ -60,7 +60,7 @@
         */
        SP.moveTo = function ( uploads ) {
                this.uploads = uploads;
-               this.ui.moveTo();
+               this.ui.moveTo( uploads );
        };
 
        /**
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 0037954..3ae392d 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -76,11 +76,8 @@
                                } ),
 
                        details: new uw.controller.Details( config )
-                               .on( 'start-details', function () {
-                                       wizard.detailsSubmit().done( function 
() {
-                                               
wizard.steps.details.showErrors();
-                                               wizard.showNext( 'details', 
'complete', finalizeDetails );
-                                       } );
+                               .on( 'details-submitted', function () {
+                                       wizard.showNext( 'details', 'complete', 
finalizeDetails );
                                } )
 
                                .on( 'details-error', function () {
@@ -652,23 +649,6 @@
                                }
                        } );
                        return count;
-               },
-
-               /**
-                * Submit all edited details and other metadata
-                * Works just like startUploads -- parallel simultaneous 
submits with progress bar.
-                * @return {jQuery.Promise}
-                */
-               detailsSubmit: function () {
-                       var deferred = $.Deferred();
-
-                       // add the upload progress bar, with ETA
-                       // add in the upload count
-                       this.steps.details.transitionAll().done( function () {
-                               deferred.resolve();
-                       } );
-
-                       return deferred.promise();
                }
        };
 
diff --git a/resources/ui/uw.ui.Step.js b/resources/ui/uw.ui.Step.js
index e1ad40a..99cf30a 100644
--- a/resources/ui/uw.ui.Step.js
+++ b/resources/ui/uw.ui.Step.js
@@ -39,6 +39,7 @@
 
        /**
         * Move to the step.
+        * @param {mw.UploadWizardUpload[]} uploads
         */
        SP.moveTo = function ( uploads ) {
                this.uploads = uploads;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I936cf4c99c9020f3bfe553c884ade43625b20cfa
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to