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".
This commit is contained in:
Toby Zerner 2017-07-22 12:08:09 +09:30
parent c1c7d4c73a
commit e3e4786391
3 changed files with 3 additions and 6 deletions

View File

@ -55,7 +55,7 @@ export default class IndexPage extends Page {
app.cache.discussionList = new DiscussionList({params}); 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'; this.bodyClass = 'App--index';
} }

View File

@ -26,8 +26,6 @@ export default class UserPage extends Page {
*/ */
this.user = null; this.user = null;
app.history.push('user');
this.bodyClass = 'App--user'; this.bodyClass = 'App--user';
} }
@ -74,7 +72,6 @@ export default class UserPage extends Page {
show(user) { show(user) {
this.user = user; this.user = user;
app.history.push('user', user.username());
app.setTitle(user.username()); app.setTitle(user.username());
m.redraw(); m.redraw();

View File

@ -50,10 +50,10 @@ export default class Navigation extends Component {
const previous = history.getPrevious() || {}; const previous = history.getPrevious() || {};
return LinkButton.component({ return LinkButton.component({
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'), className: 'Button Navigation-back Button--icon',
href: history.backUrl(), href: history.backUrl(),
icon: 'chevron-left', icon: 'chevron-left',
children: previous.title, title: previous.title,
config: () => {}, config: () => {},
onclick: e => { onclick: e => {
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return; if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;