Add a widget setting for the home logo url

This commit is contained in:
Robin Ward 2016-04-27 13:16:51 -04:00
parent 43bbc425e8
commit 02f771e66e
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D

View file

@ -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
});