Merge pull request #1056 from cezarcp/text_logo

Allow to use a text logo when logo_url setting is set to an empty value
This commit is contained in:
Robin Ward 2013-06-20 10:00:47 -07:00
commit cc90939aa8
1 changed files with 10 additions and 5 deletions

View File

@ -87,20 +87,25 @@ Discourse.HeaderView = Discourse.View.extend({
/**
Display the correct logo in the header, showing a custom small icon if it exists.
In case the logo_url setting is empty, shows the site title as the logo.
@property logoHTML
**/
logoHTML: function() {
var result = "<div class='title'><a href='" + Discourse.getURL("/") + "'>";
if (this.get('controller.showExtraInfo')) {
var logo = Discourse.SiteSettings.logo_small_url;
if (logo && logo.length > 1) {
result += "<img class='logo-small' src='" + logo + "' width='33' height='33'>";
var logoSmall = Discourse.SiteSettings.logo_small_url;
if (logoSmall && logoSmall.length > 1) {
result += "<img class='logo-small' src='" + logoSmall + "' width='33' height='33'>";
} else {
result += "<i class='icon-home'></i>";
}
} else {
result += "<img class='logo-big' src=\"" + Discourse.SiteSettings.logo_url + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
var logo = Discourse.SiteSettings.logo_url;
if(logo && logo.length > 1) {
result += "<img class='logo-big' src=\"" + logo + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
} else {
result += "<h2 class='text-logo' id='site-text-logo'>" + Discourse.SiteSettings.title + "</h2>"
}
}
result += "</a></div>";
return new Handlebars.SafeString(result);