Alex Monk has uploaded a new change for review.

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

Change subject: Move some stuff from ViewPageTarget to MWSaveDialog
......................................................................

Move some stuff from ViewPageTarget to MWSaveDialog

Part of disentangling the two

Bug: 65513
Change-Id: I3b1542c64a29d9968e815a2f32e8da3235c0a4c9
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
2 files changed, 50 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/68/140868/1

diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index a2a05f6..98b8be5 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -96,10 +96,7 @@
                'saveErrorUnknown': 'onSaveErrorUnknown',
                'loadError': 'onLoadError',
                'surfaceReady': 'onSurfaceReady',
-               'editConflict': 'onEditConflict',
                'showChanges': 'onShowChanges',
-               'showChangesError': 'onShowChangesError',
-               'noChanges': 'onNoChanges',
                'serializeError': 'onSerializeError',
                'sanityCheckComplete': 'updateToolbarSaveButtonState'
        } );
@@ -652,18 +649,6 @@
 };
 
 /**
- * Handle failed show changes event.
- *
- * @method
- * @param {Object} jqXHR
- * @param {string} status Text status message
- */
-ve.init.mw.ViewPageTarget.prototype.onShowChangesError = function ( jqXHR, 
status ) {
-       alert( ve.msg( 'visualeditor-differror', status ) );
-       this.saveDialog.popPending();
-};
-
-/**
  * Called if a call to target.serialize() failed.
  *
  * @method
@@ -672,33 +657,6 @@
  */
 ve.init.mw.ViewPageTarget.prototype.onSerializeError = function ( jqXHR, 
status ) {
        alert( ve.msg( 'visualeditor-serializeerror', status ) );
-
-       // It's possible to get here while the save dialog has never been 
opened (if the user uses
-       // the switch to source mode option)
-       if ( this.saveDialog ) {
-               this.saveDialog.popPending();
-       }
-};
-
-/**
- * Handle edit conflict event.
- *
- * @method
- */
-ve.init.mw.ViewPageTarget.prototype.onEditConflict = function () {
-       this.saveDialog.popPending();
-       this.saveDialog.swapPanel( 'conflict' );
-};
-
-/**
- * Handle failed show changes event.
- *
- * @method
- */
-ve.init.mw.ViewPageTarget.prototype.onNoChanges = function () {
-       this.saveDialog.popPending();
-       this.saveDialog.swapPanel( 'nochanges' );
-       this.saveDialog.reviewGoodButton.setDisabled( false );
 };
 
 /**
@@ -1195,6 +1153,12 @@
                'resolve': 'onSaveDialogResolveConflict',
                'teardown': 'onSaveDialogTeardown'
        } );
+       this.connect( this.saveDialog, {
+               'noChanges': 'onNoChanges',
+               'showChangesError': 'onShowChangesError',
+               'serializeError': 'onSerializeError',
+               'editConflict': 'onEditConflict',
+       } );
        // Setup edit summary and checkboxes
        this.saveDialog.setEditSummary( this.initialEditSummary );
        this.saveDialog.setupCheckboxes( this.$checkboxes );
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 97e072d..414d960 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -499,6 +499,50 @@
        ve.ui.MWSaveDialog.super.prototype.onApplyChangesFail.call( this, 
errors );
 };
 
+/**
+ * Handle failed show changes event.
+ *
+ * @method
+ */
+ve.ui.MWSaveDialog.prototype.onNoChanges = function () {
+       this.popPending();
+       this.swapPanel( 'nochanges' );
+       this.reviewGoodButton.setDisabled( false );
+};
+
+/**
+ * Handle failed show changes event.
+ *
+ * @method
+ * @param {Object} jqXHR
+ * @param {string} status Text status message
+ */
+ve.ui.MWSaveDialog.prototype.onShowChangesError = function ( jqXHR, status ) {
+       alert( ve.msg( 'visualeditor-differror', status ) );
+       this.popPending();
+};
+
+/**
+ * Called if a call to target.serialize() failed.
+ *
+ * @method
+ * @param {jqXHR|null} jqXHR
+ * @param {string} status Text status message
+ */
+ve.ui.MWSaveDialog.prototype.onSerializeError = function ( jqXHR, status ) {
+       this.popPending();
+};
+
+/**
+ * Handle edit conflict event.
+ *
+ * @method
+ */
+ve.ui.MWSaveDialog.prototype.onEditConflict = function () {
+       this.popPending();
+       this.swapPanel( 'conflict' );
+};
+
 /* Registration */
 
 ve.ui.windowFactory.register( ve.ui.MWSaveDialog );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b1542c64a29d9968e815a2f32e8da3235c0a4c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>

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

Reply via email to