From e3e47863912f97b27cb7af61eab052139121b678 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 22 Jul 2017 12:08:09 +0930 Subject: [PATCH] Simplify global back button The behaviour is not overly intuitive, and the icon wasn't helping (hamburger icon usually means "menu"). Now the back button always goes back to the index, no matter where you are, and there's a tooltip that says "Back to discussion list". --- js/forum/src/components/IndexPage.js | 2 +- js/forum/src/components/UserPage.js | 3 --- js/lib/components/Navigation.js | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/js/forum/src/components/IndexPage.js b/js/forum/src/components/IndexPage.js index 892fd36ec..10bde6c3f 100644 --- a/js/forum/src/components/IndexPage.js +++ b/js/forum/src/components/IndexPage.js @@ -55,7 +55,7 @@ export default class IndexPage extends Page { app.cache.discussionList = new DiscussionList({params}); } - app.history.push('index', icon('bars')); + app.history.push('index', app.translator.trans('core.forum.header.back_to_index_tooltip')); this.bodyClass = 'App--index'; } diff --git a/js/forum/src/components/UserPage.js b/js/forum/src/components/UserPage.js index ab7404614..e7bebdd34 100644 --- a/js/forum/src/components/UserPage.js +++ b/js/forum/src/components/UserPage.js @@ -26,8 +26,6 @@ export default class UserPage extends Page { */ this.user = null; - app.history.push('user'); - this.bodyClass = 'App--user'; } @@ -74,7 +72,6 @@ export default class UserPage extends Page { show(user) { this.user = user; - app.history.push('user', user.username()); app.setTitle(user.username()); m.redraw(); diff --git a/js/lib/components/Navigation.js b/js/lib/components/Navigation.js index 4a6bf2269..189e43339 100644 --- a/js/lib/components/Navigation.js +++ b/js/lib/components/Navigation.js @@ -50,10 +50,10 @@ export default class Navigation extends Component { const previous = history.getPrevious() || {}; return LinkButton.component({ - className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'), + className: 'Button Navigation-back Button--icon', href: history.backUrl(), icon: 'chevron-left', - children: previous.title, + title: previous.title, config: () => {}, onclick: e => { if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;