From 02f771e66ead3fb6e861bfa1fd41d8c65d10ab1d Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 27 Apr 2016 13:16:51 -0400 Subject: [PATCH] Add a widget setting for the home logo url --- .../discourse/widgets/home-logo.js.es6 | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 index 408b7da13..4f95c85a9 100644 --- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 +++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 @@ -1,11 +1,15 @@ -import DiscourseURL from 'discourse/lib/url'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; import { iconNode } from 'discourse/helpers/fa-icon'; +import interceptClick from 'discourse/lib/intercept-click'; export default createWidget('home-logo', { tagName: 'div.title', + settings: { + href: '/' + }, + logo() { const { siteSettings } = this; const mobileView = this.site.mobileView; @@ -33,15 +37,8 @@ export default createWidget('home-logo', { }, html() { - return h('a', { attributes: { href: "/", 'data-auto-route': true } }, this.logo()); + return h('a', { attributes: { href: this.settings.href } }, this.logo()); }, - click(e) { - if (e.shiftKey || e.metaKey || e.ctrlKey || e.button !== 0) { return true; } - - e.preventDefault(); - - DiscourseURL.routeTo("/"); - return false; - } + click: interceptClick });