Haritha28 has uploaded a new change for review.

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

Change subject: Exiting edit collection loses changes(WIP)
......................................................................

Exiting edit collection loses changes(WIP)

As we open the edit pane and click the back
button, a confirmation box will appear to
check if user has confirmed to discard/save his
changes.

Bug:T103892
Change-Id: I63d22fab651e4982043ea2fcad24d3764a06ec02
---
M resources/ext.gather.collection.editor/CollectionEditOverlay.js
1 file changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/48/281248/1

diff --git a/resources/ext.gather.collection.editor/CollectionEditOverlay.js 
b/resources/ext.gather.collection.editor/CollectionEditOverlay.js
index 342a359..89cb17a 100644
--- a/resources/ext.gather.collection.editor/CollectionEditOverlay.js
+++ b/resources/ext.gather.collection.editor/CollectionEditOverlay.js
@@ -324,10 +324,19 @@
                onSettingsBackClick: function () {
                        if ( this.id ) {
                                // reset the values to their original values.
-                               this.$( 'input.title' ).val( 
this.options.collection.title );
-                               this.$( '.description' ).val( 
this.options.collection.description );
-                               // Note: we will need to reset checkbox when 
enabling private/public toggle.
-                               this._switchToFirstPane();
+
+                               if (this.activePane === 'edit') {
+                                       if ( !window.confirm( 
this.options.confirmExitMessage ) ) {
+                                               this.$( 'input.title' ).val( 
this.options.collection.title );
+                                               this.$( '.description' ).val( 
this.options.collection.description );
+                                               // Note: we will need to reset 
checkbox when enabling private/public toggle.
+                                               this._switchToFirstPane();
+                                       }
+                                       else {
+                                               this.onSaveDescriptionClick();
+                                       }
+                               }
+
                        } else {
                                Overlay.prototype.hide.apply( this, arguments );
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63d22fab651e4982043ea2fcad24d3764a06ec02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Haritha28 <[email protected]>

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

Reply via email to