From 06a50e92aa57ff37fd9f175c6549f43c56ec5236 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 25 Jun 2015 08:14:51 +0930 Subject: [PATCH] Make home button route correctly, not respond on middle click Amends flarum/core#140, closes flarum/core#136 --- framework/core/js/forum/src/initializers/boot.js | 6 ++++++ framework/core/js/forum/src/utils/history.js | 3 +-- framework/core/views/forum.blade.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/framework/core/js/forum/src/initializers/boot.js b/framework/core/js/forum/src/initializers/boot.js index 6ac66658b..cbfed3123 100644 --- a/framework/core/js/forum/src/initializers/boot.js +++ b/framework/core/js/forum/src/initializers/boot.js @@ -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()); diff --git a/framework/core/js/forum/src/utils/history.js b/framework/core/js/forum/src/utils/history.js index d51e5e948..cac63144d 100644 --- a/framework/core/js/forum/src/utils/history.js +++ b/framework/core/js/forum/src/utils/history.js @@ -37,7 +37,6 @@ export default class History { home() { this.stack.splice(1); - var top = this.top(); - m.route(top.url); + m.route('/'); } } diff --git a/framework/core/views/forum.blade.php b/framework/core/views/forum.blade.php index 197acffc1..7a7dae34e 100644 --- a/framework/core/views/forum.blade.php +++ b/framework/core/views/forum.blade.php @@ -4,7 +4,7 @@