Make home button route correctly, not respond on middle click

Amends flarum/core#140, closes flarum/core#136
This commit is contained in:
Toby Zerner 2015-06-25 08:14:51 +09:30
parent 1f9be042dd
commit 06a50e92aa
3 changed files with 8 additions and 3 deletions

View File

@ -35,6 +35,12 @@ export default function(app) {
}
});
$('#home-link').click(e => {
if (e.ctrlKey || e.metaKey || e.which === 2) return;
e.preventDefault();
app.history.home();
});
m.mount(id('header-primary'), HeaderPrimary.component());
m.mount(id('header-secondary'), HeaderSecondary.component());
m.mount(id('footer-primary'), FooterPrimary.component());

View File

@ -37,7 +37,6 @@ export default class History {
home() {
this.stack.splice(1);
var top = this.top();
m.route(top.url);
m.route('/');
}
}

View File

@ -4,7 +4,7 @@
<header class="global-header" id="header">
<div id="back-button"></div>
<div class="container">
<h1 class="header-title"><a href="{{ $config['base_url'] }}" onclick="app.history.home()">{{ $config['forum_title'] }}</a></h1>
<h1 class="header-title"><a href="{{ $config['base_url'] }}" id="home-link">{{ $config['forum_title'] }}</a></h1>
<div id="header-primary" class="header-primary"></div>
<div id="header-secondary" class="header-secondary"></div>
</div>