mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 05:43:16 +08:00
Allow the href
setting to be a function.
This commit is contained in:
parent
a244c33023
commit
1ac6dd194d
|
@ -11,6 +11,11 @@ export default createWidget('home-logo', {
|
|||
href: '/'
|
||||
},
|
||||
|
||||
href() {
|
||||
const href = this.settings.href;
|
||||
return (typeof href === "function") ? href() : href;
|
||||
},
|
||||
|
||||
logo() {
|
||||
const { siteSettings } = this;
|
||||
const mobileView = this.site.mobileView;
|
||||
|
@ -38,13 +43,13 @@ export default createWidget('home-logo', {
|
|||
},
|
||||
|
||||
html() {
|
||||
return h('a', { attributes: { href: this.settings.href } }, this.logo());
|
||||
return h('a', { attributes: { href: this.href(), 'data-auto-route': true } }, this.logo());
|
||||
},
|
||||
|
||||
click(e) {
|
||||
if (wantsNewWindow(e)) { return false; }
|
||||
e.preventDefault();
|
||||
DiscourseURL.routeTo(this.settings.href);
|
||||
DiscourseURL.routeTo(this.href());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user