Add a widget setting for the home logo url
This commit is contained in:
parent
43bbc425e8
commit
02f771e66e
|
@ -1,11 +1,15 @@
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon';
|
||||||
|
import interceptClick from 'discourse/lib/intercept-click';
|
||||||
|
|
||||||
export default createWidget('home-logo', {
|
export default createWidget('home-logo', {
|
||||||
tagName: 'div.title',
|
tagName: 'div.title',
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
href: '/'
|
||||||
|
},
|
||||||
|
|
||||||
logo() {
|
logo() {
|
||||||
const { siteSettings } = this;
|
const { siteSettings } = this;
|
||||||
const mobileView = this.site.mobileView;
|
const mobileView = this.site.mobileView;
|
||||||
|
@ -33,15 +37,8 @@ export default createWidget('home-logo', {
|
||||||
},
|
},
|
||||||
|
|
||||||
html() {
|
html() {
|
||||||
return h('a', { attributes: { href: "/", 'data-auto-route': true } }, this.logo());
|
return h('a', { attributes: { href: this.settings.href } }, this.logo());
|
||||||
},
|
},
|
||||||
|
|
||||||
click(e) {
|
click: interceptClick
|
||||||
if (e.shiftKey || e.metaKey || e.ctrlKey || e.button !== 0) { return true; }
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
DiscourseURL.routeTo("/");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue