Robmoen has uploaded a new change for review. https://gerrit.wikimedia.org/r/221772
Change subject: Reload collection when exiting overlay after making changes. ...................................................................... Reload collection when exiting overlay after making changes. * Reload collection if collection settings were changed and overlay ** Was exited by clicking the back or cancel button. * If collection name changes, reload with correct url. Bug: T104025 Change-Id: I991dc45335e0c5b97b335af795628147799b76b5 --- M resources/ext.gather.collection.editor/CollectionEditOverlay.js 1 file changed, 28 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather refs/changes/72/221772/1 diff --git a/resources/ext.gather.collection.editor/CollectionEditOverlay.js b/resources/ext.gather.collection.editor/CollectionEditOverlay.js index 02659ee..d47efd0 100644 --- a/resources/ext.gather.collection.editor/CollectionEditOverlay.js +++ b/resources/ext.gather.collection.editor/CollectionEditOverlay.js @@ -94,7 +94,8 @@ 'input .search-header input': 'onRunSearch', 'click .search-header .back': 'onExitSearch', 'click .save-description': 'onSaveDescriptionClick', - 'click .back': 'onBackClick', + 'click .back': 'onSettingsBackClick', + 'click .cancel': 'onCancelClick', 'click .save': 'onFirstPaneSaveClick', 'click .collection-privacy': 'onToggleCollectionPrivacy' } ), @@ -106,8 +107,13 @@ } ), /** @inheritdoc */ initialize: function ( options ) { + // Initial properties; + this.id = null; + this.originalTitle = ''; + if ( options && options.collection ) { this.id = options.collection.id; + this.originalTitle = options.collection.title; } else { options.collection = { // New collection is public by default @@ -121,13 +127,11 @@ }, /** @inheritdoc */ postRender: function () { - var id = this.id; Overlay.prototype.postRender.apply( this, arguments ); - if ( id ) { + if ( this.id ) { this._populateCollectionMembers(); } else { - this.id = null; this._switchToSettingsPane(); } }, @@ -296,9 +300,18 @@ deleteOverlay.show(); }, /** + * Event handler when the cancel (back) button is clicked on the edit pane. + */ + onCancelClick: function () { + Overlay.prototype.onExit.apply( this, arguments ); + if ( this._stateChanged ) { + this._reloadCollection(); + } + }, + /** * Event handler when the back button is clicked on the title/edit description pane. */ - onBackClick: function () { + onSettingsBackClick: function () { if ( this.id ) { // reset the values to their original values. this.$( 'input.title' ).val( this.options.collection.title ); @@ -316,9 +329,18 @@ _reloadCollection: function () { var self = this; window.setTimeout( function () { + var collection; router.navigate( '/' ); if ( self.options.reloadOnSave ) { - window.location.reload(); + collection = self.options.collection; + // Reload collection with updated title in url + if ( self.originalTitle !== collection.title ) { + window.location.href = mw.util.getUrl( + [ 'Special:Gather', 'id', collection.id, collection.title ].join( '/' ) + ); + } else { + window.location.reload(); + } } }, 100 ); }, -- To view, visit https://gerrit.wikimedia.org/r/221772 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I991dc45335e0c5b97b335af795628147799b76b5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: master Gerrit-Owner: Robmoen <rm...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits