Skip to content

Commit cc90939

Browse files
committed
Merge pull request discourse#1056 from cezarcp/text_logo
Allow to use a text logo when logo_url setting is set to an empty value
2 parents 6c37a8f + 132b049 commit cc90939

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/assets/javascripts/discourse/views/header_view.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,25 @@ Discourse.HeaderView = Discourse.View.extend({
8787

8888
/**
8989
Display the correct logo in the header, showing a custom small icon if it exists.
90-
90+
In case the logo_url setting is empty, shows the site title as the logo.
9191
@property logoHTML
9292
**/
9393
logoHTML: function() {
9494
var result = "<div class='title'><a href='" + Discourse.getURL("/") + "'>";
9595
if (this.get('controller.showExtraInfo')) {
96-
var logo = Discourse.SiteSettings.logo_small_url;
97-
if (logo && logo.length > 1) {
98-
result += "<img class='logo-small' src='" + logo + "' width='33' height='33'>";
96+
var logoSmall = Discourse.SiteSettings.logo_small_url;
97+
if (logoSmall && logoSmall.length > 1) {
98+
result += "<img class='logo-small' src='" + logoSmall + "' width='33' height='33'>";
9999
} else {
100100
result += "<i class='icon-home'></i>";
101101
}
102102
} else {
103-
result += "<img class='logo-big' src=\"" + Discourse.SiteSettings.logo_url + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
103+
var logo = Discourse.SiteSettings.logo_url;
104+
if(logo && logo.length > 1) {
105+
result += "<img class='logo-big' src=\"" + logo + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
106+
} else {
107+
result += "<h2 class='text-logo' id='site-text-logo'>" + Discourse.SiteSettings.title + "</h2>"
108+
}
104109
}
105110
result += "</a></div>";
106111
return new Handlebars.SafeString(result);

0 commit comments

Comments
 (0)