From acd989cabbadf76e3ee33e901d99e07a37cd4a5e Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 28 Aug 2016 23:55:45 +0200 Subject: [PATCH] client/tags: fix URL redirections User controller didn't need intervention but I refactored it to match tag controller anyway. --- client/js/controllers/tag_controller.js | 9 ++++++--- client/js/controllers/user_controller.js | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/js/controllers/tag_controller.js b/client/js/controllers/tag_controller.js index 0951b16e..74a6e4a1 100644 --- a/client/js/controllers/tag_controller.js +++ b/client/js/controllers/tag_controller.js @@ -22,7 +22,7 @@ class TagController { topNavigation.setTitle('Tag #' + tag.names[0]); this._name = ctx.parameters.name; - tag.addEventListener('change', e => this._evtSaved(e)); + tag.addEventListener('change', e => this._evtSaved(e, section)); const categories = {}; for (let category of tags.getAllCategories()) { @@ -57,10 +57,11 @@ class TagController { misc.enableExitConfirmation(); } - _evtSaved(e) { + _evtSaved(e, section) { misc.disableExitConfirmation(); if (this._name !== e.detail.tag.names[0]) { - router.replace('/tag/' + e.detail.tag.names[0], null, false); + router.replace( + '/tag/' + e.detail.tag.names[0] + '/' + section, null, false); } } @@ -97,6 +98,8 @@ class TagController { e.detail.tag.merge(e.detail.targetTagName).then(() => { this._view.showSuccess('Tag merged.'); this._view.enableForm(); + router.replace( + '/tag/' + e.detail.targetTagName + '/merge', null, false); }, errorMessage => { this._view.showError(errorMessage); this._view.enableForm(); diff --git a/client/js/controllers/user_controller.js b/client/js/controllers/user_controller.js index 0e2b9611..e9aeb7d3 100644 --- a/client/js/controllers/user_controller.js +++ b/client/js/controllers/user_controller.js @@ -26,7 +26,7 @@ class UserController { const infix = isLoggedIn ? 'self' : 'any'; this._name = userName; - user.addEventListener('change', e => this._evtSaved(e)); + user.addEventListener('change', e => this._evtSaved(e, section)); const myRankIndex = api.user ? api.allRanks.indexOf(api.user.rank) : @@ -73,11 +73,11 @@ class UserController { misc.enableExitConfirmation(); } - _evtSaved(e) { + _evtSaved(e, section) { misc.disableExitConfirmation(); if (this._name !== e.detail.user.name) { router.replace( - '/user/' + e.detail.user.name + '/edit', null, false); + '/user/' + e.detail.user.name + '/' + section, null, false); } }